The useShopQuery hook allows you to make server-only GraphQL queries to the Storefront API. It must be a descendent of a ShopifyProvider component.

Example code


The useShopQuery takes an object as its only argument, with the following keys:

Key Required Description
query Yes A string of the GraphQL query.
variables No An object of the variables for the GraphQL query.
cache No An object describing the cache policy for the request.

Return value

The useShopQuery returns an object with the following keys:

Key Description
data The data returned by the query.