shopify-storefront-api

Build headless Shopify storefronts using the GraphQL Storefront API for products, carts, and checkout.

3|1|Updated Mar 21, 2026
One-click install
npx skills add https://github.com/tomtoto757/ecomm-ai-team --skill shopify-storefront-api-tomtoto757
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: shopify-storefront-api
Source: https://github.com/tomtoto757/ecomm-ai-team/tree/main/skills/platform-integrations-infrastructure/finsilabs/platform-shopify/shopify-storefront-api
Command: npx skills add https://github.com/tomtoto757/ecomm-ai-team --skill shopify-storefront-api-tomtoto757

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @shopify/storefront-api-client.

What problem does it solve? Building a custom headless Shopify frontend requires correctly wiring up the Storefront API: token management, GraphQL queries for products and collections, cart mutations, and checkout redirects. This Skill provides production-tested patterns so you avoid common mistakes like exposing private tokens, losing cart state, or breaking checkout on mobile Safari. ## Core Features & Use Cases - Storefront Client Setup: Configure public and private Storefront Access Tokens with the official @shopify/storefront-api-client package for browser and server contexts. - Product & Collection Queries: Fetch paginated product data with cursor-based pagination, localized pricing via the @inContext directive, and availability checks at both product and variant level. - Cart & Checkout Flow: Create carts, add line items, persist cart IDs in localStorage, handle userErrors, and redirect to Shopify's hosted checkout. - Use Case: A DTC brand moving to a Next.js 14 headless storefront can use this Skill to implement the entire data layer — product listing pages with ISR, variant pickers, predictive search, and a persistent shopping cart. ## Quick Start Ask the AI to set up a Shopify Storefront API client in TypeScript with product fetching and a persistent cart hook for a Next.js headless storefront.

Frequently Asked Questions about shopify-storefront-api

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a headless Shopify storefront with Next.js?▼

Use the @shopify/storefront-api-client package with a Storefront Access Token to query products and manage carts via GraphQL. Fetch product data at build time with SSG or ISR, and redirect customers to Shopify's hosted checkoutUrl for payment.

What is the difference between Shopify Storefront API public and private access tokens?▼

Public tokens are safe to expose in browser JavaScript and allow storefront-scoped operations at lower rate limits. Private tokens offer higher rate limits (1000 req/s vs 100 req/s) and must only be used server-side, never shipped to the client.

How do I show prices in the customer's local currency with the Storefront API?▼

Add the @inContext directive to your GraphQL query, for example @inContext(country: $country), passing the buyer's ISO country code. Shopify returns priceRange and variant price fields converted to that country's currency.

Why does my Shopify cart lose items after a page reload?▼

The cart ID is not persisted across sessions. Store the cartId returned by cartCreate in localStorage or a cookie, read it on initialization, and reuse it with cartLinesAdd instead of creating a new cart each visit.

Why does the Shopify checkout redirect fail on mobile Safari?▼

Mobile Safari blocks programmatic navigation from async callbacks. Assign window.location.href = checkoutUrl inside a synchronous user gesture handler such as a click event, not inside a Promise.then() or after an await.

How do I match the correct variant when a product has multiple options?▼

Compare all selectedOptions on each variant against the user's selections, such as both Size and Color. Matching on a single option can return the wrong variant when products have multiple option axes.