Shopify GraphQL recipes

Queries and mutations for the jobs developers search for most: bulk exports, metafields, products, inventory, discounts, orders and the Storefront cart.

In short

These are copy-ready GraphQL documents for Shopify’s Admin and Storefront APIs, version 2026-10. Each page has the query or mutation, example variables, the access scopes it needs and what the response looks like. Every document and its variables are validated against Shopify’s published schema before we publish. The REST Admin API is legacy, so new apps should use these GraphQL calls.

  • 27 pages, free to use in any store, including client work (MIT license)

Bulk operations

Export and import large amounts of data without paging through it.

Metafields and metaobjects

Store and read your own data on products, customers and more.

Products and inventory

Create products and variants, and keep stock in sync.

Discounts and Functions

Create discounts and switch Functions on from code.

Orders and customers

Edit orders, create drafts, fulfill, refund and tag.

  • Edit an order after it was placed

    Add items, change quantities and commit the change with orderEditBegin, orderEditAddVariant, orderEditSetQuantity and orderEditCommit.

  • Refund an order

    Calculate a refund with suggestedRefund, then refund line items, restock them and return the money with refundCreate and an idempotency key.

  • List the customers in a segment

    Page through the members of a customer segment with customerSegmentMembers, or run an ad hoc segment query with customerSegmentMembersQueryCreate.

  • Translate content, also per market

    Read a resource’s translatable content and digests with translatableResource, then save translations, optionally for one market, with translationsRegister.

Webhooks

Get told when something changes instead of polling.

  • Subscribe to a webhook with a filter

    Only receive the webhooks you need: create a subscription with webhookSubscriptionCreate and a filter in Shopify search syntax, or in shopify.app.toml.

Storefront API

Carts, local prices and custom data for headless storefronts.

Basics

Pagination, query cost and rate limits.

About the code

  • Validated against the Admin or Storefront API schema for version 2026-10 on the date shown. Check the version in your request URL.
  • IDs and store addresses in the examples are placeholders. Replace them with your own.
  • Admin API calls need an access token from your app. Never put an Admin API token in a storefront or theme.
  • MIT license. Use the code in your own store or in client work.

Need this built, tested and maintained for your store? See API integrations.

Questions

Is the Shopify REST Admin API deprecated?
Shopify calls it legacy since October 2024, and new public apps have had to use GraphQL since April 2025. Shopify has not announced a date to switch REST off entirely. Each recipe here names the REST call it replaces.
Where can I run these queries?
In the GraphiQL app for your store, in your app’s code with an access token, or with the Shopify CLI. Storefront API queries also run from a browser with a public Storefront token.
Which API version do the recipes use?
Version 2026-10, the latest stable version on the date each page was checked. Most documents also work on the versions before and after it; the page notes any field that changed.

Have something to build? Let’s talk it through.

Taking a limited number of projects at a time. Every brief is read by an engineer, not a salesperson.

Gencer KarakayaShopify Engineer

An engineer reads your brief, and we reply by email.