Product Price
The ProductPrice component renders a Money component with the product priceRange's maxVariantPrice or minVariantPrice, for either the regular price or compare at price range.
Anchor to propsProps
- Anchor to datadatadataPartialDeep<Product, {recurseIntoArrays: true}>PartialDeep<Product, {recurseIntoArrays: true}>requiredrequired
A Storefront API Product object.
- Anchor to asasasComponentGenericComponentGeneric
An HTML tag or React Component to be rendered as the base element wrapper. The default is
div.- Anchor to measurementSeparatormeasurement
Separatormeasurement Separator ReactNodeReactNode Customizes the separator between the money output and the measurement output. Used with the
measurementprop. Defaults to'/'.- Anchor to priceTypeprice
Typeprice Type 'regular' | 'compareAt''regular' | 'compareAt' The type of price. Valid values:
regular(default) or.- Anchor to valueTypevalue
Typevalue Type 'max' | 'min' | 'unit''max' | 'min' | 'unit' The type of value. Valid values:
min(default),maxorunit.- Anchor to variantIdvariant
Idvariant Id stringstring The ID of the variant.
- Anchor to withoutCurrencywithout
Currencywithout Currency booleanboolean Whether to remove the currency symbol from the output.
- Anchor to withoutTrailingZeroswithout
Trailing Zeroswithout Trailing Zeros booleanboolean Whether to remove trailing zeros (fractional money) from the output.
Examples
import {ProductPrice} from '@shopify/hydrogen-react';
export function ProductPricing({product}) {
return <ProductPrice data={product} priceType="compareAt" valueType="max" />;
}
Examples
Example code
Description
I am the default example
JavaScript
import {ProductPrice} from '@shopify/hydrogen-react'; export function ProductPricing({product}) { return <ProductPrice data={product} priceType="compareAt" valueType="max" />; }TypeScript
import {ProductPrice} from '@shopify/hydrogen-react'; import type {Product} from '@shopify/hydrogen-react/storefront-api-types'; export function ProductPricing({product}: {product: Product}) { return <ProductPrice data={product} priceType="compareAt" valueType="max" />; }
Was this page helpful?