The Storefront API is a GraphQL API that requires an access token associated with a specific Shopify store. You can call the API from any HTTP client. You can have a maximum of 100 active storefronts and access tokens per shop.
Here you'll be doing the following tasks :
- Create a Headless channel in your Shopify admin
- Generate Storefront API access tokens
- Manage storefront permissions
Requirements :
- You have the staff role on the Shopify store that you're working with.
- You have Apps and channels permissions on the Shopify store that you're working with.
Step 1: Enable Storefront API access :
Install the Headless channel from the Shopify App Store. On installation, you're provided public and private access tokens that enable public and authenticated access to the Storefront API.(Optional) Create another storefront:
- From your Shopify admin, under Sales channels, click Headless.
- Click Create storefront.
Step 2: Manage permissions :
Managing permissions controls what your custom storefront can display from your Shopify store.
- From your Shopify admin, select the Headless sales channel.
- From the list, select the storefront.
- Beside Storefront API permissions, click Edit.
- Select the permissions for the storefront.
- Click Save.
Step 3: Make queries :
After you've selected the Storefront API permissions for your custom storefront and have Storefront API access tokens, you can make queries using the Storefront API.
Shopify provides the following resources for learning how to make GraphQL queries to Shopify's Storefront API:
- GraphiQL explorer : Start exploring the Storefront API on a demo shop with the interactive GraphiQL explorer.
- Storefront API Learning Kit : Download example queries from the Storefront API Learning Kit.