feat: regen docs
This commit is contained in:
parent
58afc97bae
commit
74a7cfbd67
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/cli and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/cli and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
## `@shopify/hydrogen-cli`
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/AddToCartButton and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/AddToCartButton and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `AddToCartButton` component renders a button that adds an item to the cart when pressed.
|
||||
It must be a descendent of the `CartProvider` component.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/BuyNowButton and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/BuyNowButton and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `BuyNowButton` component renders a button that adds an item to the cart and redirects the customer to checkout.
|
||||
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
---
|
||||
gid: c7df6e06-3c6c-4c35-b6fe-82bfac8b6b95
|
||||
title: CartCheckoutButton
|
||||
description: Use the CartCheckoutButton to render a button that redirects to checkoutUrl for the cart.
|
||||
---
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/CartCheckoutButton and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `CartCheckoutButton` component renders a button that redirects to the checkout URL for the cart.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/CartEstimatedCost and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/CartEstimatedCost and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The [CartEstimatedCost](/api/storefront/reference/cart/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`.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/CartLineAttributes and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/CartLineAttributes and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `CartLineAttributes` component takes a function as a child and calls that function for each of the
|
||||
cart line's attributes. It must be a descendent of a `CartLineProvider` component.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/CartLineImage and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/CartLineImage and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `CartLineImage` component renders an `Image` component for the cart line merchandise's image.
|
||||
It must be a descendent of a `CartLineProvider` component.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/CartLinePrice and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/CartLinePrice and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `CartLinePrice` component renders a `Money` component for the cart line merchandise's price or
|
||||
compare at price. It must be a descendent of a `CartLineProvider` component.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/CartLineProductTitle and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/CartLineProductTitle and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `CartLineProductTitle` component renders a `span` element (or the type of HTML element specified by
|
||||
the `as` prop) with the cart line merchandise's title. It must be a descendent of a `CartLineProvider` component.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/CartLineProvider and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/CartLineProvider and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `useCartLine` hook provides access to the cart line object. It must be a descendent of a `CartProvider` component.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/CartLineQuantity and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/CartLineQuantity and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `CartLineQuantity` component renders a `span` element (or the type of HTML element
|
||||
specified by the `as` prop) with the cart line's quantity. It must be a descendent of a `CartLineProvider` component.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/CartLineQuantityAdjustButton and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/CartLineQuantityAdjustButton and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `CartLineQuantityAdjustButton` component renders a button that adjusts the cart line's quantity when pressed.
|
||||
It must be a descendent of a `CartLineProvider` component.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/CartLineSelectedOptions and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/CartLineSelectedOptions and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `CartLineSelectedOptions` component takes a function as a child and calls that function
|
||||
for each of the cart line merchandise's selected options. It must be a descendent of a `CartLineProvider` component.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/CartLines and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/CartLines and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `CartLines` component iterates over each cart line and renders its `children` within
|
||||
a `CartLineProvider` for each cart line. It also provides render props in the case where `children` is a function.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/CartProvider and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/CartProvider and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
## Example code
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/CartShopPayButton and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/CartShopPayButton and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `CartShopPayButton` component renders a `ShopPayButton` for the items in the cart.
|
||||
It must be a descendent of a `CartProvider` component.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/ExternalVideo and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/ExternalVideo and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `ExternalVideo` component renders an embedded video for the Storefront
|
||||
API's [`ExternalVideo` object](/api/storefront/reference/products/externalvideo).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/Image and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/Image and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `Image` component renders an image for the Storefront API's
|
||||
[`Image` object](/api/storefront/reference/common-objects/image).
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
---
|
||||
gid: 2d9f4930-fafe-11eb-9a03-0242ac130003
|
||||
title: LocalizationProvider
|
||||
description: Use a LocalizationProvider component to automatically query the Storefront API's localization field for the ISO code, name of the country, and available countries, and keep this information in a context.
|
||||
---
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/LocalizationProvider and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `LocalizationProvider` component automatically queries the Storefront API's [`localization`](/api/storefront/reference/common-objects/queryroot) field for the `isoCode` and `name` of the `country` and `availableCountries` and keeps this information in a context.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/MediaFile and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/MediaFile and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `MediaFile` component renders the media for the Storefront API's
|
||||
[Media object](/api/storefront/reference/products/media). It renders an `Image`, a
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/Metafield and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/Metafield and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `Metafield` component renders the value of a Storefront
|
||||
API's [Metafield object](/api/storefront/reference/common-objects/metafield).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/Model3D and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/Model3D and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `Model3D` component renders a 3D model (with the `model-viewer` tag) for
|
||||
the Storefront API's [`Model3d` object](/api/storefront/reference/products/model3d).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /Users/michellevinci/src/github.com/Shopify/hydrogen/packages/hydrogen/src/components/Money and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/Money and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `Money` component renders a string of the Storefront API's
|
||||
[`MoneyV2` object](/api/storefront/reference/common-objects/moneyv2) according to the
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/ProductDescription and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/ProductDescription and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `ProductDescription` component renders a `RawHtml` component with
|
||||
the product's [`descriptionHtml`](/api/storefront/reference/products/product).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/ProductMetafield and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/ProductMetafield and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `ProductMetafield` component renders a
|
||||
[`Metafield`](/api/hydrogen/components/primitive/metafield) component with the product metafield.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/ProductPrice and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/ProductPrice and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `ProductPrice` component renders a `Money` component with the product
|
||||
[`priceRange`](/api/storefront/reference/products/productpricerange)'s `maxVariantPrice`
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/ProductProvider and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/ProductProvider and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `useProduct` hook returns the product object of the nearest `ProductProvider`. It must be a descendent of
|
||||
a `ProductProvider` component.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/ProductTitle and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/ProductTitle and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `ProductTitle` component renders a `span` element (or the type of
|
||||
HTML element specified by the `as` prop) with the product's [`title`](/api/storefront/reference/products/product).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/RawHtml and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/RawHtml and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `RawHtml` component renders an HTML string as HTML DOM elements. This should be used for
|
||||
displaying rich text-like descriptions associated with a product.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/SelectedVariantAddToCartButton and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/SelectedVariantAddToCartButton and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `SelectedVariantAddToCartButton` component renders a `AddToCartButton` for the product's
|
||||
selected variant. Clicking this button automatically adds the selected variant to the cart.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/SelectedVariantBuyNowButton and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/SelectedVariantBuyNowButton and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `SelectedVariantBuyNowButton` component renders a `BuyNowButton` for the product's selected variant.
|
||||
Clicking this button automatically adds the selected variant to the cart and redirect the customer to checkout.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/SelectedVariantImage and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/SelectedVariantImage and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `SelectedVariantImage` component renders an `Image` component for the product's selected variant's image.
|
||||
It must be a descendent of a `ProductProvider` component.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/SelectedVariantMetafield and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/SelectedVariantMetafield and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `SelectedVariantMetafield` component renders a [`Metafield`](/api/hydrogen/components/primitive/metafield)
|
||||
component with the selected product's metafield.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/SelectedVariantPrice and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/SelectedVariantPrice and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `SelectedVariantPrice` component renders a `Money` component for the product's selected variant's price or compare at price.
|
||||
It must be a descendent of a `ProductProvider` component.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/SelectedVariantShopPayButton and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/SelectedVariantShopPayButton and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `SelectedVariantShopPayButton` component renders a `ShopPayButton` for the product's selected variant.
|
||||
It must be a descendent of a `ProductProvider` component.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/SelectedVariantUnitPrice and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/SelectedVariantUnitPrice and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `SelectedVariantUnitPrice` component renders a `UnitPrice` component for the product's selected variant's unit price.
|
||||
It must be a descendent of a `ProductProvider`.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/ShopPayButton and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/ShopPayButton and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `ShopPayButton` component renders a button that redirects to the Shop Pay checkout.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/UnitPrice and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/UnitPrice and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `UnitPrice` component renders a string with a [UnitPrice](/themes/pricing-payments/unit-pricing) as the
|
||||
[Storefront API's `MoneyV2` object](/api/storefront/reference/common-objects/moneyv2) with a reference unit from
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/components/Video and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/components/Video and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `Video` component renders a `video` for the Storefront API's [`Video` object](/api/storefront/reference/products/video).
|
||||
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
---
|
||||
gid: b4dc58a2-fafe-11eb-9a03-0242ac130003
|
||||
title: ShopifyProvider
|
||||
description: Use the ShopifyProvider component to wrap your entire app and provide support for hooks.
|
||||
---
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/foundation/ShopifyProvider and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `ShopifyProvider` component wraps your entire app and provides support for hooks. You should place it in your app's entry point component. For example, `<App>`.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/foundation/useServerState and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/foundation/useServerState and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `useServerState` hook allows you to [manage server state](/api/hydrogen/framework/server-state) when using Hydrogen as a React Server Component framework.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/foundation/useShop and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/foundation/useShop and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `useShop` hook provides access to values within `shopify.config.js`.The `useShop` hook provides access to values within `shopify.config.js`. It must be a descendent of a `ShopifyProvider` component.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/hooks/useAvailableCountries and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/hooks/useAvailableCountries and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `useAvailableCountries` hook returns an array of available countries used for localization.
|
||||
It must be a descendent of a `LocalizationProvider` component.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/hooks/useCart and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/hooks/useCart and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `useCart` hook provides access to the cart object. It must be a descendent of a `CartProvider` component.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/hooks/useCartAttributesUpdateCallback and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/hooks/useCartAttributesUpdateCallback and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `useCartAttributesUpdateCallback` hook returns a callback that can be used to update the cart's attributes. It must be a descendent of a `CartProvider` component.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/hooks/useCartBuyerIdentityUpdateCallback and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/hooks/useCartBuyerIdentityUpdateCallback and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `useCartBuyerIdentityUpdateCallback` hook returns a callback that can be used to update the cart's buyer identity. It must be a descendent of a `CartProvider` component.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/hooks/useCartCheckoutUrl and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/hooks/useCartCheckoutUrl and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `useCartCheckoutUrl` hook returns a string of the checkout URL for the cart. It must be a descendent of a `CartProvider` component.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/hooks/useCartCreateCallback and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/hooks/useCartCreateCallback and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `useCartCreateCallback` hook returns a callback that can be used to create a cart. It must be a descendent of a `CartProvider` component.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/hooks/useCartDiscountCodesUpdateCallback and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/hooks/useCartDiscountCodesUpdateCallback and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `useCartDiscountCodesUpdateCallback` hook returns a callback that can be used to update the cart's discount codes. It must be a descendent of a `CartProvider` component.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/hooks/useCartLine and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/hooks/useCartLine and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `useCartLine` hook provides access to the cart line object. It must be a descendent of a `CartProvider` component.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/hooks/useCartLinesAddCallback and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/hooks/useCartLinesAddCallback and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `useCartLinesAddCallback` hook returns a callback that can be used to add lines to a cart. If a cart doesn't
|
||||
already exist, then it will create the cart for you. It must be a descendent of a `CartProvider` component.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/hooks/useCartLinesRemoveCallback and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/hooks/useCartLinesRemoveCallback and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `useCartLinesRemoveCallback` hook returns a callback that can be used to remove lines from a cart. It must be a descendent of a `CartProvider` component.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/hooks/useCartLinesTotalQuantity and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/hooks/useCartLinesTotalQuantity and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `useCartLinesTotalQuantity` hook returns the total amount of items in the cart. It must be a descendent of a `CartProvider` component.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/hooks/useCartLinesUpdateCallback and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/hooks/useCartLinesUpdateCallback and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `useCartLinesUpdateCallback` hook returns a callback that can be used to update lines in a cart. It must be a descendent of a `CartProvider` component.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/hooks/useCartNoteUpdateCallback and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/hooks/useCartNoteUpdateCallback and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `useCartNoteUpdateCallback` hook returns a callback that can be used to update the cart's note. It must be a descendent of a `CartProvider` component.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/hooks/useCountry and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/hooks/useCountry and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `useCountry` hook returns a tuple of the current localization country and a function for updating it.
|
||||
It must be a descendent of a `LocalizationProvider` component.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/hooks/useMoney and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/hooks/useMoney and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `useMoney` hook takes a [`MoneyV2` object](/api/storefront/reference/common-objects/moneyv2) and returns a
|
||||
default-formatted string of the amount with the correct currency indicator, along with some of the parts provided by
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/hooks/useParsedMetafields and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/hooks/useParsedMetafields and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `useParsedMetafields` hook transforms a [MetafieldConnection](/api/storefront/reference/common-objects/metafieldconnection)
|
||||
in an array of metafields whose `values` have been parsed according to the metafield `type`.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/hooks/useProduct and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/hooks/useProduct and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `useProduct` hook returns the product object of the nearest `ProductProvider`. It must be a descendent of
|
||||
a `ProductProvider` component.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/hooks/useProductOptions and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/hooks/useProductOptions and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `useProductOptions` hook returns an object that enables you to keep track of the
|
||||
selected variant and/or selling plan state, as well as callbacks for modifying the state.
|
||||
|
@ -25,7 +25,7 @@ export function MyComponent() {
|
|||
value={selectedVariant?.id}
|
||||
onChange={(e) =>
|
||||
setSelectedVariant(
|
||||
variants.find((variant) => variant.id === e.target.value)
|
||||
variants.find((variant) => variant.id === e.target.value),
|
||||
)
|
||||
}
|
||||
>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/hooks/useProductOptions and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/hooks/useQuery and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `useQuery` hook is a wrapper around `useQuery` from `react-query`. It supports Suspense calls on the server and on the client.
|
||||
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
The `useServerState` hook allows you to [manage server state](/api/hydrogen/framework/server-state) when using Hydrogen as a React Server Component framework.
|
||||
|
||||
## Return value
|
||||
|
||||
The `useServerState` hook returns an object with the following keys:
|
||||
|
||||
| Key | Description |
|
||||
| ---------------- | -------------------------------------------------------------------------------------- |
|
||||
| `serverState` | The current server state. |
|
||||
| `setServerState` | A function used to modify server state. |
|
||||
| `pending` | Whether a [transition is pending](https://github.com/reactwg/react-18/discussions/41). |
|
||||
|
||||
## `setServerState`
|
||||
|
||||
For convenience, `setServerState` accepts arguments in the following ways:
|
||||
|
||||
{% codeblock file %}
|
||||
|
||||
```js
|
||||
// Update a top-level state property based on key
|
||||
setServerState(key: string, value: any)
|
||||
|
||||
// Spread a new value object onto existing state
|
||||
setServerState(newValue: object)
|
||||
|
||||
// Provide a callback function to update the state completely
|
||||
setServerState((previousState) => object)
|
||||
```
|
||||
|
||||
{% endcodeblock %}
|
|
@ -1,35 +0,0 @@
|
|||
The `useShop` hook provides access to values within `shopify.config.js`.
|
||||
|
||||
> Note:
|
||||
> It must be a descendent of a `ShopifyProvider` component.
|
||||
|
||||
## Example code
|
||||
|
||||
{% codeblock file %}
|
||||
|
||||
```jsx
|
||||
import {useShop} from '@shopify/hydrogen';
|
||||
|
||||
export default function MyPage() {
|
||||
const {locale} = useShop();
|
||||
|
||||
return <h1>The locale is {locale}</h1>;
|
||||
}
|
||||
```
|
||||
|
||||
{% endcodeblock %}
|
||||
|
||||
## Return value
|
||||
|
||||
The `useShop` hook returns an object with the following keys:
|
||||
|
||||
| Key | Description |
|
||||
| ---- | ----------- |
|
||||
| `locale` | The locale set in `shopify.config.js`. |
|
||||
| `storeDomain` | The store domain set in `shopify.config.js`. |
|
||||
| `storefrontToken` | The Storefront API token set in `shopify.config.js`. |
|
||||
| `graphqlApiVersion` | The GraphQL API version set in `shopify.config.js`. |
|
||||
|
||||
## Related components
|
||||
|
||||
- [`ShopifyProvider`](/api/hydrogen/components/global/shopifyprovider)
|
|
@ -1,6 +1,6 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/hooks/useShopQuery and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/hooks/useShopQuery and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `useShopQuery` hook allows you to make server-only GraphQL queries to the Storefront API. The `useShop` hook provides access to values within `shopify.config.js`. It must be a descendent of a `ShopifyProvider` component.
|
||||
The `useShopQuery` hook allows you to make server-only GraphQL queries to the Storefront API. The `useShop` hook provides access to values within `shopify.config.js`. It must be a descendent of a `ShopifyProvider` component.
|
||||
|
||||
## Example code
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/utilities/flattenConnection and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/utilities/flattenConnection and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `flattenConnection` utility transforms a connection object from the Storefront API (for example, [Product-related connections](api/storefront/reference/products/product#connections)) into a flat array of nodes.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/utilities/isClient and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/utilities/isClient and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `isClient` utility is a function that returns a boolean indicating
|
||||
if the code was run on the client.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/utilities/isServer and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/utilities/isServer and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `isServer` utility is a function that returns a `boolean` indicating
|
||||
if the code was run on the server.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- This file is generated from the source code. Edit the files in /packages/hydrogen/src/utilities/parseMetafieldValue and run 'yarn generate-docs' at the root of this repo. -->
|
||||
<!-- This file is generated from source code in the Shopify/hydrogen repo. Edit the files in /packages/hydrogen/src/utilities/parseMetafieldValue and run 'yarn generate-docs' at the root of this repo. For more information, refer to https://github.com/Shopify/shopify-dev/blob/master/content/internal/operations/hydrogen-reference-docs.md. -->
|
||||
|
||||
The `parseMetafieldValue` function parses a [Metafield](/api/storefront/reference/common-objects/metafield)'s `value` from a string into a sensible type corresponding to the [Metafield](/api/storefront/reference/common-objects/metafield)'s `type`.
|
||||
|
||||
|
@ -67,7 +67,7 @@ export function Product({handle}) {
|
|||
|
||||
const metafields = flattenConnection(data.product.metafields);
|
||||
const parsedMetafields = metafields.map((metafield) =>
|
||||
parseMetafieldValue(metafield)
|
||||
parseMetafieldValue(metafield),
|
||||
);
|
||||
|
||||
return (
|
||||
|
|
Loading…
Reference in a new issue