Skip to content
Back to blog

How I cut Shopify catalog updates from 8 hours to 1 with Python & GraphQL

A practical look at the Python + Shopify Admin GraphQL toolkit behind bulk price, catalog and multi-branch inventory updates for a 50,000-product store.

Ahmed Showky

Full Stack Web Developer

1 min read

Tawheed & Nour sells more than 50,000 products across many branches. Prices, stock and collections change every day — and for a long time, updating even 300 products by hand in the Shopify admin took a full working day.

This is how I turned that into a ~1 hour job with a small Python toolkit on top of the Shopify Admin GraphQL API.

The problem with manual updates

Manual edits don't just cost time. They also cause:

  • Drift between the ERP (the source of truth) and the storefront
  • Price and stock mistakes that customers notice before you do
  • Slow campaigns, because every promotion waits for someone to edit products one by one

The approach

  1. Export from the ERP as a clean CSV per branch.
  2. Validate every row in Python: SKU exists, price is a number, stock isn't negative.
  3. Batch the changes into GraphQL mutations instead of one REST call per product.
  4. Respect rate limits by reading the query cost Shopify returns and pausing when the bucket runs low.
  5. Report what changed, what was skipped, and why.

A bulk variant update

The core of the tool is one mutation that updates many variants of a product in a single request:

MUTATION = '''
mutation UpdateVariants($productId: ID!, $variants: [ProductVariantsBulkInput!]!) {
  productVariantsBulkUpdate(productId: $productId, variants: $variants) {
    userErrors { field message }
  }
}
'''

def update_variants(session, product_id, variants):
    response = session.post(GRAPHQL_URL, json={
        "query": MUTATION,
        "variables": {"productId": product_id, "variants": variants},
    })
    response.raise_for_status()
    errors = response.json()["data"]["productVariantsBulkUpdate"]["userErrors"]
    return errors

Results

A 300-product update went from a full working day (about 8 hours) to roughly one hour — and the same scripts now power inventory sync across branches.

Just as important, the team trusts the numbers again. Every run leaves a report, so mistakes are caught before customers see them.

What I'd tell any growing store

  • Treat your ERP or spreadsheet as the single source of truth and sync from it.
  • Automate the boring 80% first. You don't need a giant app, just a few reliable scripts.
  • Add QA checks (broken links, price or stock gaps) next to the sync. That's where the real time savings are.

Have a project in mind?

I build fast, bilingual stores and web apps. Let’s talk about yours.

Start a project

Keep reading