hydrogen/packages/hydrogen/src/components/SelectedVariantUnitPrice/README.md
2021-11-09 18:20:09 -08:00

1.4 KiB

The SelectedVariantUnitPrice component renders a UnitPrice component for the product's selected variant's unit price. It must be a descendent of a ProductProvider.

Example code

import {SelectedVariantUnitPrice, ProductProvider} from '@shopify/hydrogen';

export function ProductDetails({product}) {
  return (
    <ProductProvider value={product}>
      <SelectedVariantUnitPrice />
    </ProductProvider>
  );
}

Alias

The SelectedVariantUnitPrice component is aliased by the Product.SelectedVariant.UnitPrice component. You can use whichever component you prefer.

Component type

The SelectedVariantUnitPrice component is a client component, which means that it renders on the client. For more information about component types, refer to React Server Components.