# OrderSummary

The `OrderSummary` component is a summary component that displays the total price of the order. You can use this component to show the total price of the order.

### Props <a href="#props-3" id="props-3"></a>

#### className `string?` <a href="#classname-string-2" id="classname-string-2"></a>

The class name that is applied to the summary element. This prop is optional, and it defaults to an empty string.

#### fallback `React.ReactNode?` <a href="#fallback-reactreactnode-3" id="fallback-reactreactnode-3"></a>

A fallback component that is shown while the data is loading. This prop is optional, and it defaults to `null`.

#### OrderSummaryUIComponent `React.ComponentType<`[OrderSummaryUIProps](https://github.com/firmhouse/firmhouse-sdk/blob/alpha/packages/headless-react/src/lib/components/order-summary-ui.tsx#L6-L19)`>?` <a href="#ordersummaryuicomponent-reactcomponenttypeordersummaryuiprops" id="ordersummaryuicomponent-reactcomponenttypeordersummaryuiprops"></a>

A custom component that is used to render the order summary. This prop is optional, and it defaults to the [`OrderSummaryUI`](https://github.com/firmhouse/firmhouse-sdk/blob/alpha/packages/headless-react/src/lib/components/order-summary-ui.tsx) component. This component receives the necessary data to render the order summary.

### Example <a href="#example-1" id="example-1"></a>

```jsx
import { formatCentsWithCurrency } from "@firmhouse/firmhouse-sdk";

function CustomOrderSummaryUI({
  totalAmount,
  totalTaxAmount,
  cart,
  children,
  currency,
  t,
}) {
  return (  
    <div>
      <div>
        <p>{t?.("orderSummary.toPayNow")}</p>
        <p>
          <span>{t?.("orderSummary.subtotal")}</span>
          <span>
            {formatCentsWithCurrency(totalAmount, currency, locale ?? cart?.locale)}
          </span>
        </p>
        <p>
          <span>
            {t?.("orderSummary.shippingCost")}
          </span>
          <span>{t?.("orderSummary.free")}</span>
        </p>
        <p>
          <span>{t?.("orderSummary.total")}</span>
          <span>
            {formatCentsWithCurrency(totalAmount, currency, locale ?? cart?.locale)}
          </span>
        </p>
        <p>
          <span>
            {t?.("orderSummary.tax", {
              amount: formatCentsWithCurrency(
                totalTaxAmount ?? 0,
                currency,
                locale ?? cart?.locale
              ),
            })}
          </span>
        </p>
        {children}
      </div>
    </div>
  );
}

<OrderSummary OrderSummaryUIComponent={CustomOrderSummaryUI} />
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.firmhouse.com/sdks/headless-react/components/ordersummary.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
