Book a callFree 30-min discovery call
Completed · Client: US online retailer (anonymised)

Wholesale Supplier → Shopify Inventory Sync

A store kept selling products its wholesale supplier had already run out of. We connected the supplier's live stock feed to Shopify, so thousands of products stay correct without anyone touching them.

Wholesale Supplier → Shopify Inventory Sync
Impact

3,599 products corrected in one run with zero errors; prices and content are never touched.

TL;DR

  • 3,599 SKUs updated in a single run, 0 errors.
  • Only stock quantities are touched. Never prices, content or products.
  • Safe by design: exact SKU matching, a dry-run mode and a full log for every run.

The problem

The store sells thousands of products that are shipped by a large US wholesale distributor. Shopify's stock levels were updated by hand, every now and then. In between, customers could order items that were already sold out at the warehouse. Every one of those orders meant a cancellation, a refund, an apology email and a slightly less loyal customer.

What we built

A small, focused integration between the distributor's data feed and the Shopify Admin API, running on a schedule.

How it works

  1. 1
    Download the supplier feed. The distributor publishes a live feed (JSON and CSV) with every SKU and its available quantity. The script loads it into a SKU → quantity map.
  2. 2
    Read the Shopify catalogue. All products and variants are pulled through the Admin REST API, 250 per page, following the pagination links and pausing briefly between pages to respect rate limits.
  3. 3
    Build a plan. For every Shopify variant:
    • not in the supplier feed → leave it alone,
    • SKU appears twice in Shopify → skip it as ambiguous,
    • not inventory-tracked in Shopify → skip it,
    • quantity already correct → nothing to do,
    • otherwise → queue an update from the current to the target quantity.
  4. 4
    Dry run (optional). --dry-run prints the plan and the first 20 changes without writing anything.
  5. 5
    Write in batches. Updates go through the GraphQL inventorySetQuantities mutation, 250 SKUs per call, at the store's primary location, with reason: correction.
  6. 6
    Log and save state. Every run writes a timestamped log (updates, already correct, skipped and why, errors per batch) and a state file with the last run time and count.

Under the hood

DecisionWhy
Inventory onlyThe client's team owns prices and content. The sync must never overwrite their work.
Exact SKU match onlyFuzzy matching on a catalogue this size is how you sell the wrong product.
Skip duplicate SKUsIf a SKU exists twice in Shopify, there's no safe answer, so we report it instead of guessing.
GraphQL bulk mutationOne call per 250 SKUs instead of 3,599 REST calls. A full run takes seconds.
Credentials in an env fileShop domain and admin token stay out of the code and out of git.
Plain Python + requestsNo framework, nothing to maintain. It runs on any cron or scheduler.

Results

MetricValue
SKUs in the supplier feed18,429
Products in the Shopify store19,029
Already correct8,376
Skipped as ambiguous (duplicate SKU)307
SKUs corrected in one run (12 Oct 2026)3,599
Batches / batches with errors15 / 0
Write phase / full run~27 seconds / ~3.5 minutes (mostly reading the catalogue)
Manual stock updates neededNone

What we learned

  • *Most of the work is deciding what not* to touch.** The core sync is a few dozen lines. The safety rules around it are what make a client trust it on a live store.
  • Dry runs sell the project. Showing the client exactly which products would change, before changing anything, turned a nervous "yes" into a confident one.

Connected projects

Gallery

Images.

How it works: Wholesale Supplier → Shopify Inventory Sync

Ready to build your AI project?

Free 30-minute discovery call. No pitch. Just a conversation about what AI could do for you.

  • Free · 30 min
  • A concrete first step you can act on
  • In German or English, online
Wholesale Supplier → Shopify Inventory Sync | AI Labs