A Shopify API mock for testing inventory updates.

Your agent reads seeded products and warehouse stock through GraphQL, then adjusts inventory. Query the inventory level again to check the quantity at the chosen location.

Connect your agent
The test
  • inventory_adjusted

    Calls the inventoryAdjustQuantities mutation

Starting records

  • locations

    ref
    oakland
    name
    Oakland warehouse
  • products

    ref
    gateway
    title
    Acme Edge Gateway
    vendor
    Acme

Connect your agent to the Shopify mock

When ancha runs your agent, it sets:

  • SHOPIFY_API_URL
  • SHOPIFY_ACCESS_TOKEN
  • SHOPIFY_API_VERSION
  • SHOPIFY_STOREFRONT_ACCESS_TOKEN
  • SHOPIFY_API_SECRET

Point the client you already use at them.

import { createAdminApiClient } from '@shopify/admin-api-client';
const shopify = createAdminApiClient({ storeDomain: 'acme-store.myshopify.com', apiVersion: process.env.SHOPIFY_API_VERSION!, accessToken: process.env.SHOPIFY_ACCESS_TOKEN!,
  customFetchApi: (url, init) => fetch(String(url).replace(/^https:\/\/[^/]+/, process.env.SHOPIFY_API_URL!), init) });
const { data, errors } = await shopify.request('{ orders(first: 10) { nodes { id name } } }');

import { createGraphQLClient } from '@shopify/graphql-client';
const storefront = createGraphQLClient({
  url: process.env.SHOPIFY_API_URL! + '/api/' + process.env.SHOPIFY_API_VERSION! + '/graphql.json',
  headers: { 'X-Shopify-Storefront-Access-Token': process.env.SHOPIFY_STOREFRONT_ACCESS_TOKEN! },
});
const catalog = await storefront.request('{ products(first: 10) { nodes { id title variants(first: 10) { nodes { id price { amount currencyCode } } } } } }');
// Verify order webhooks with process.env.SHOPIFY_API_SECRET and the raw request body.

Locally, ancha runs your agent as an ordinary process, so keep real Shopify credentials out of its environment.

See all 47 endpoints

cart

STOREFRONT QUERYcart

cartAttributesUpdate

STOREFRONT MUTATIONcartAttributesUpdate

cartBuyerIdentityUpdate

STOREFRONT MUTATIONcartBuyerIdentityUpdate

cartCreate

STOREFRONT MUTATIONcartCreate

cartLinesAdd

STOREFRONT MUTATIONcartLinesAdd

cartLinesRemove

STOREFRONT MUTATIONcartLinesRemove

cartLinesUpdate

STOREFRONT MUTATIONcartLinesUpdate

cartNoteUpdate

STOREFRONT MUTATIONcartNoteUpdate

collection

STOREFRONT QUERYcollection

collections

STOREFRONT QUERYcollections

customer

QUERYcustomer

customerCreate

MUTATIONcustomerCreate

customers

QUERYcustomers

customerUpdate

MUTATIONcustomerUpdate

fulfillmentCreate

MUTATIONfulfillmentCreate

fulfillmentOrder

QUERYfulfillmentOrder

fulfillmentTrackingInfoUpdate

MUTATIONfulfillmentTrackingInfoUpdate

inventoryAdjustQuantities

MUTATIONinventoryAdjustQuantities

inventoryItem

QUERYinventoryItem

inventorySetQuantities

MUTATIONinventorySetQuantities

job

QUERYjob

location

QUERYlocation

locations

QUERYlocations

node

QUERYnode
STOREFRONT QUERYnode

nodes

QUERYnodes
STOREFRONT QUERYnodes

order

QUERYorder

orderCancel

MUTATIONorderCancel

orderClose

MUTATIONorderClose

orderMarkAsPaid

MUTATIONorderMarkAsPaid

orderOpen

MUTATIONorderOpen

orders

QUERYorders

orderUpdate

MUTATIONorderUpdate

product

QUERYproduct
STOREFRONT QUERYproduct

products

QUERYproducts
STOREFRONT QUERYproducts

productUpdate

MUTATIONproductUpdate

productVariant

QUERYproductVariant

productVariants

QUERYproductVariants

productVariantsBulkUpdate

MUTATIONproductVariantsBulkUpdate

refundCreate

MUTATIONrefundCreate

shop

QUERYshop
STOREFRONT QUERYshop

tagsAdd

MUTATIONtagsAdd

tagsRemove

MUTATIONtagsRemove

Seed your own data

The data the Shopify mock starts with on every run, cut to a few records. ancha twins seed shopify prints every field.

Full seed YAML
twins:
  - shopify
seed:
  shopify:
    shop:
      name: Acme Store
      domain: acme-store
      email: store@acme.example
      owner: Ben Carter
      created: -9000h
    locations:
      - ref: oakland
        name: Oakland warehouse
        address:
          address1: 1200 Embarcadero
          city: Oakland
          province_code: CA
          zip: "94606"
          phone: "+15105550142"
        created: -9000h
    products:
      - ref: gateway
        title: Acme Edge Gateway
        vendor: Acme
        product_type: Hardware
        tags:
          - gateway
        created: -6000h
        description_html: <p>Connects warehouse sensors to Acme over Ethernet or LTE. Includes a power supply and a one-year warranty.</p>
        options:
          - Connectivity
        variants:
          - ref: gateway_eth
            options:
              - Ethernet
            sku: AEG-ETH
            barcode: "0850041200016"
            price: "349.00"
            cost: "182.00"
            inventory:
              oakland: 31
    customers:
      - ref: grace
        first_name: Grace
        last_name: Lin
        email: grace.lin@bluefield-logistics.example
        tags:
          - b2b
        state: ENABLED
        created: -500h
        address:
          company: Bluefield Logistics
          address1: 800 Harbor Way
          city: Columbus
          province_code: OH
          zip: "43215"
    orders:
      - ref: order_bluefield
        customer: grace
        created: -400h
        line_items:
          - variant: gateway_eth
            quantity: 2
        shipping:
          title: UPS Ground
          price: "15.00"
        tags:
          - b2b
        fulfillments:
          - at: -390h
            tracking:
              company: UPS
              number: 1Z4A81W90312345671
              url: https://www.ups.com/track?tracknum=1Z4A81W90312345671
            delivered: -340h

Check what your agent did

Checks YAML
checks:
  - id: inventory_adjusted
    trace:
      called: MUTATION inventoryAdjustQuantities

Tested together

All 43 tools

Shopify API mock FAQ

How do I check which Shopify warehouse an agent changed?

In the mock, inventoryAdjustQuantities applies each delta to the specified inventoryItemId and locationId. Read the item’s inventoryLevel(locationId:) and quantities(names: ["available"]) to inspect stock at that location.

What happens when an inventory agent acts on an old Shopify stock count?

Pass the expected stock count as changeFromQuantity in the mock’s inventorySetQuantities mutation. If it differs from the current quantity, userErrors contains CHANGE_FROM_QUANTITY_STALE and the mutation leaves inventory unchanged.

How can a Shopify inventory adjustment be retried without applying its delta twice?

Use the same @idempotent(key:) value and arguments when retrying inventoryAdjustQuantities. The mock returns the existing adjustment group; reusing the key with different arguments produces IDEMPOTENCY_KEY_PARAMETER_MISMATCH in userErrors.

Install the CLI and run your agent against the Shopify mock.

Book a demo

Ancha is not affiliated with Shopify.