DEV Community

Tùng Nguyễn
Tùng Nguyễn

Posted on Edited on

Automating Shopify & WooCommerce Competitor Price Monitoring & Contact Extraction with Python

Whether you run an e-commerce brand, a dropshipping research agency, or a B2B wholesale supply business, tracking competitor product catalogs, stock availability, price drops, and store contact details across Shopify and WooCommerce stores is a massive competitive advantage.

In this tutorial, we'll cover how to extract full product catalogs (title, SKU, price, compare_at_price, in_stock, variants, images) plus store owner emails & social links using Python.


âš¡ Ready-to-Use Cloud Scrapers & Standalone Tools


🔍 How Shopify & WooCommerce Expose Structured Product JSON

  1. Shopify Stores: Almost all Shopify storefronts expose a paginated JSON feed at /products.json?limit=250&page=1 containing every product, variant price, compare-at price, SKU, vendor, and availability flag.
  2. WooCommerce Stores: Modern WooCommerce stores expose the Store API at /wp-json/wc/store/v1/products?per_page=100, with fallback to ld+json Product schema and OpenGraph price tags.

Python Example: Fetching Shopify Products + Discount Calculation

import requests

def fetch_shopify_catalog(store_url: str, max_items: int = 100) -> list[dict]:
    base = store_url.rstrip('/')
    resp = requests.get(f"{base}/products.json?limit=250&page=1", timeout=15)
    resp.raise_for_status()
    products = resp.json().get('products', [])[:max_items]

    rows = []
    for p in products:
        v = (p.get('variants') or [{}])[0]
        price = float(v.get('price') or 0)
        compare_at = float(v.get('compare_at_price') or 0)
        discount_pct = round((compare_at - price) / compare_at * 100, 1) if compare_at > price else 0.0
        rows.append({
            'title': p.get('title'),
            'vendor': p.get('vendor'),
            'product_type': p.get('product_type'),
            'price': price,
            'compare_at_price': compare_at or None,
            'discount_pct': discount_pct,
            'in_stock': bool(v.get('available')),
            'sku': v.get('sku'),
            'url': f"{base}/products/{p.get('handle')}",
        })
    return rows
Enter fullscreen mode Exit fullscreen mode

🚀 Need Custom E-Commerce Monitoring or Excel Dashboards?


🌐 Live REST APIs on RapidAPI Hub & Instant Download Store

Top comments (0)