Storefront API
api_access capability enabled in shopify.extension.toml.The Storefront API provides access to Shopify's Storefront API from within a checkout extension. Use this API to fetch product details, load collection data, and query any resource available through Shopify's Storefront API.
Anchor to Use casesUse cases
- Fetch product recommendations: Query the Storefront API to load related products and display cross-sell or upsell offers in checkout.
- Load collection metadata: Retrieve collection details to show contextual information about items in the buyer's cart.
- Access inventory or variant data: Query product variants and inventory levels to display availability or delivery estimates.
Supported targets
- purchase.
address-autocomplete. format-suggestion - purchase.
address-autocomplete. suggest - purchase.
checkout. actions. render-before - purchase.
checkout. block. render - purchase.
checkout. cart-line-item. render-after - purchase.
checkout. cart-line-list. render-after - purchase.
checkout. chat. render - purchase.
checkout. contact. render-after - purchase.
checkout. delivery-address. render-after - purchase.
checkout. delivery-address. render-before - purchase.
checkout. footer. render-after - purchase.
checkout. header. render-after - purchase.
checkout. payment-method-list. render-after - purchase.
checkout. payment-method-list. render-before - purchase.
checkout. pickup-location-list. render-after - purchase.
checkout. pickup-location-list. render-before - purchase.
checkout. pickup-location-option-item. render-after - purchase.
checkout. pickup-point-list. render-after - purchase.
checkout. pickup-point-list. render-before - purchase.
checkout. reductions. render-after - purchase.
checkout. reductions. render-before - purchase.
checkout. shipping-option-item. details. render - purchase.
checkout. shipping-option-item. render-after - purchase.
checkout. shipping-option-list. render-after - purchase.
checkout. shipping-option-list. render-before - purchase.
thank-you. announcement. render - purchase.
thank-you. block. render - purchase.
thank-you. cart-line-item. render-after - purchase.
thank-you. cart-line-list. render-after - purchase.
thank-you. chat. render - purchase.
thank-you. customer-information. render-after - purchase.
thank-you. footer. render-after - purchase.
thank-you. header. render-after
Supported targets
- purchase.
address-autocomplete. format-suggestion - purchase.
address-autocomplete. suggest - purchase.
checkout. actions. render-before - purchase.
checkout. block. render - purchase.
checkout. cart-line-item. render-after - purchase.
checkout. cart-line-list. render-after - purchase.
checkout. chat. render - purchase.
checkout. contact. render-after - purchase.
checkout. delivery-address. render-after - purchase.
checkout. delivery-address. render-before - purchase.
checkout. footer. render-after - purchase.
checkout. header. render-after - purchase.
checkout. payment-method-list. render-after - purchase.
checkout. payment-method-list. render-before - purchase.
checkout. pickup-location-list. render-after - purchase.
checkout. pickup-location-list. render-before - purchase.
checkout. pickup-location-option-item. render-after - purchase.
checkout. pickup-point-list. render-after - purchase.
checkout. pickup-point-list. render-before - purchase.
checkout. reductions. render-after - purchase.
checkout. reductions. render-before - purchase.
checkout. shipping-option-item. details. render - purchase.
checkout. shipping-option-item. render-after - purchase.
checkout. shipping-option-list. render-after - purchase.
checkout. shipping-option-list. render-before - purchase.
thank-you. announcement. render - purchase.
thank-you. block. render - purchase.
thank-you. cart-line-item. render-after - purchase.
thank-you. cart-line-list. render-after - purchase.
thank-you. chat. render - purchase.
thank-you. customer-information. render-after - purchase.
thank-you. footer. render-after - purchase.
thank-you. header. render-after
Anchor to MethodsMethods
The shopify global object provides access to the Storefront GraphQL API. Use shopify.query() or the shopify:storefront fetch protocol to execute GraphQL queries. Available to purchase extension targets.
- Anchor to queryqueryquery<Data = unknown, Variables = Record<string, unknown>>(query: string, options?: { variables?: Variables; version?: StorefrontApiVersion; }) => Promise<{ data?: Data; errors?: GraphQLError[]; }><Data = unknown, Variables = Record<string, unknown>>(query: string, options?: { variables?: Variables; version?: StorefrontApiVersion; }) => Promise<{ data?: Data; errors?: GraphQLError[]; }>requiredrequired
The method used to query the Storefront GraphQL API with a prefetched token.
StorefrontApiVersion
The supported Storefront API versions. Pass one of these values to `query()` to target a specific API version when querying the Storefront GraphQL API.
'2022-04' | '2022-07' | '2022-10' | '2023-01' | '2023-04' | '2023-07' | '2024-01' | '2024-04' | '2024-07' | '2024-10' | '2025-01' | '2025-04' | 'unstable' | '2025-07' | '2025-10'GraphQLError
An error returned by the Storefront GraphQL API. Contains a human-readable `message` and an `extensions` object with the request ID and error code for debugging.
- extensions
Additional error metadata including the request ID and error code.
{ requestId: string; code: string; } - message
A human-readable description of the error.
string
Anchor to Best practicesBest practices
- Prefer
shopify.query()over rawfetch(): Thequery()helper handles authentication, versioning, and error formatting automatically. Usefetch()with theshopify:storefrontprotocol only when you need lower-level control over the request. - Minimize query complexity: Checkout extensions run in a latency-sensitive context. Request only the fields you need and avoid deeply nested queries to keep the checkout fast.
- Handle loading and error states: Storefront API requests are asynchronous. The
query()method returns bothdataanderrors, and a response might contain partial data alongside errors. Show a loading indicator while data loads and display a graceful fallback if the request fails or returns errors.
Anchor to LimitationsLimitations
- The Storefront API requires the
api_accesscapability inshopify.extension.toml. Without it,shopify.query()isn't available andfetch()calls toshopify:storefrontare rejected. - Storefront API rate limits apply to all queries made from checkout extensions. Heavy or frequent queries may be throttled, which can slow down the checkout experience.