queryShop
The queryShop
utility is a function that helps you query the Storefront API within API
routes. queryShop
is the API
route version of useShopQuery
, which is available in server components.
Example code
Anchor link to section titled "Example code"
The queryShop
utility accepts a single argument object with the following properties:
Property | Type | Description | Required |
---|---|---|---|
query |
string | ASTNode |
A string of the GraphQL query. If no query is provided, then the useShopQuery hook makes no calls to the Storefront API. |
Yes |
variables |
Record<string, any> |
An object of the variables for the GraphQL query. | No |
locale |
string |
A string corresponding to a valid locale identifier like EN-US used to make the request. Defaults to the locale value from the ShopifyProvider component. |
No |