2 KiB
2 KiB
The CartEstimatedCost component renders a Money
component with the
cost associated with the amountType
prop. If no amountType
prop is specified, then it defaults to totalAmount
.
If children
is a function, then it will pass down the render props provided by the parent component.
Example code
import {CartProvider, CartEstimatedCost} from '@shopify/hydrogen';
export default function MyCart() {
return (
<CartProvider>
<CartEstimatedCost amountType="total" />
</CartProvider>
);
}
Props
Name | Type | Description |
---|---|---|
amountType? | "total" | "subtotal" | "tax" | "duty" |
A string type that defines the type of cost needed. Valid values: total , subtotal , tax , or duty . |
children? | React |
A function that takes an object return by the useMoney hook and returns a ReactNode . |
Component type
The CartEstimatedCost
component is a client component, which means that it renders on the client.
For more information about component types, refer to React Server Components.