Skip to main content
Independent community resource — not affiliated with the official OpenClaw project. Learn more
Part 1 of 5OpenClaw for E-commerce

Inventory & Stock Monitoring with OpenClaw

What you can monitor

Stock problems come in two forms: moving too fast (stockouts) and not moving at all (dead stock). Both cost money — one through lost sales, the other through tied-up capital and storage costs. OpenClaw automates the monitoring for both, so you catch them before they become expensive.

Low stock alerts

Alert when any SKU falls below your configured threshold — different thresholds per product tag or category.

Out-of-stock detection

Immediately flag products that hit zero so you can decide whether to hide them, backorder them, or rush a reorder.

Reorder point calculation

Calculate the ideal reorder point per SKU based on actual sales velocity and your supplier lead times.

Dead stock identification

Find products with stock on hand but no sales in the past 60 or 90 days — ranked by capital tied up.

Supplier message drafts

Auto-generate a draft reorder message for any SKU that has hit its reorder point, ready for you to review and send.

Multi-location stock

Monitor inventory levels across multiple Shopify locations and flag when one location is critically low while another has surplus.

Connecting to Shopify

You need a private app access token with read scopes for inventory and products. The token is created once and stored in your secrets.env file — OpenClaw never sees your Shopify admin password.

  1. Create a custom app In your Shopify admin go to Settings → Apps → Develop apps → Create an app. Give it a name like "OpenClaw Monitor".
  2. Configure API scopes Under Configuration → Admin API integration, enable: read_inventory, read_products, read_orders, read_fulfillments. Save.
  3. Install and reveal the token Click Install app, then Reveal token once. Copy it immediately — Shopify only shows it once.
  4. Store credentials securely Add to your secrets.env: SHOPIFY_STORE=yourstore.myshopify.com and SHOPIFY_TOKEN=shpat_xxxxxxxxxxxx. Never commit this file to git.
  5. Test the connection Run: curl -H "X-Shopify-Access-Token: $SHOPIFY_TOKEN" https://$SHOPIFY_STORE/admin/api/2024-01/products/count.json. A JSON response with a count confirms it works.

Connecting to WooCommerce

WooCommerce uses a consumer key/secret pair rather than a single token. Generate these from WooCommerce → Settings → Advanced → REST API → Add key. Set permissions to Read — you don't need write access for monitoring.

# secrets.env — WooCommerce credentials
WOO_URL=https://yourstore.com
WOO_CONSUMER_KEY=ck_xxxxxxxxxxxxxxxxxxxx
WOO_CONSUMER_SECRET=cs_xxxxxxxxxxxxxxxxxxxx

WooCommerce REST API base URL is /wp-json/wc/v3/. Authentication uses Basic Auth with the key and secret. All configs in this guide include a platform: woocommerce option that switches the endpoint and auth method automatically.

Low stock and out-of-stock alerts

The core agent queries your inventory levels, filters by threshold, and outputs an alert report. You define different thresholds per product tag so fast-moving items get earlier warnings than slow movers.

# AGENTS.md — stock-monitor agent

agents:
  stock-monitor:
    description: "Check inventory levels and alert on low or out-of-stock products"
    tools:
      - shopify-admin-api   # swap for woocommerce-api if needed
    config:
      platform: shopify     # or: woocommerce
      credentials:
        store: "${SHOPIFY_STORE}"
        token: "${SHOPIFY_TOKEN}"
      thresholds:
        default: 10           # alert when stock ≤ 10 units
        tag_overrides:
          fast-mover: 25      # alert earlier for fast-moving products
          slow-mover: 3       # alert later for slow movers
          seasonal: 5
        out_of_stock: 0       # always flag at zero
      locations: all          # or list specific location IDs
      ignore_tags:
        - discontinued
        - bundle
    output:
      format: markdown
      sections:
        - out_of_stock        # zero stock — highest priority
        - below_threshold     # above zero but at/below threshold
        - reorder_suggested   # items at calculated reorder point
      sort_by: stock_qty      # lowest first
      include_fields:
        - sku
        - product_title
        - variant_title
        - stock_qty
        - threshold
        - avg_daily_sales
        - days_remaining      # stock_qty / avg_daily_sales
⚠️ Variants matter: Shopify products often have multiple variants (size, colour). The stock-monitor agent checks inventory at the variant level, not the product level. A product showing "in stock" at the product level may have individual variants at zero. Make sure your thresholds apply to variants, not just parent products.

Reorder point calculation

A reorder point tells you when to place a new order so you don't run out before the next delivery arrives. The formula is straightforward:

# Reorder point formula
# reorder_point = (avg_daily_sales × lead_time_days) + safety_stock
#
# Example:
#   avg_daily_sales = 4 units/day
#   lead_time = 7 days
#   safety_stock = 10 units (buffer for demand spikes)
#   reorder_point = (4 × 7) + 10 = 38 units
#
# When stock hits 38 → place new order immediately

OpenClaw calculates avg_daily_sales from your order history automatically. You supply lead times per supplier in your config:

# AGENTS.md — reorder-calculator agent

agents:
  reorder-calculator:
    description: "Calculate reorder points and identify SKUs that need ordering"
    tools:
      - shopify-admin-api
    config:
      platform: shopify
      credentials:
        store: "${SHOPIFY_STORE}"
        token: "${SHOPIFY_TOKEN}"
      sales_window_days: 30        # use last 30 days to calculate avg daily sales
      supplier_lead_times:         # days from order to delivery, by supplier tag
        default: 7
        overseas: 21
        local: 3
      safety_stock_multiplier: 1.5 # safety stock = avg_daily_sales × lead_time × 0.5
      ignore_tags:
        - discontinued
        - print-on-demand          # no inventory to manage
    output:
      format: markdown_table
      columns: [sku, product_title, current_stock, avg_daily_sales, lead_time, reorder_point, days_until_stockout, action]
      filter: reorder_point_reached  # only show SKUs needing action
      sort_by: days_until_stockout   # most urgent first

Dead stock identification

Dead stock ties up cash and storage space. OpenClaw identifies it by cross-referencing sales history with current inventory: if stock exists but nothing has sold in your defined window, it's flagged. The report ranks by estimated capital value so you address the most expensive dead stock first.

# AGENTS.md — dead-stock-finder agent

agents:
  dead-stock-finder:
    description: "Find products with stock on hand and no recent sales"
    tools:
      - shopify-admin-api
    config:
      platform: shopify
      credentials:
        store: "${SHOPIFY_STORE}"
        token: "${SHOPIFY_TOKEN}"
      no_sales_window_days: 60      # flag if no sales in last 60 days
      min_stock_qty: 1              # must have stock on hand to be flagged
      ignore_tags:
        - seasonal                  # seasonal items may be expected to be dormant
        - new-arrival               # new products get 30 days grace
      new_arrival_grace_days: 30
    output:
      format: markdown_table
      columns: [sku, product_title, stock_qty, cost_price, estimated_value, last_sale_date, days_dormant]
      sort_by: estimated_value      # highest capital tied up first
      include_summary:
        total_skus_flagged: true
        total_estimated_value: true
    schedule: weekly
💡 What to do with dead stock: Once identified, common actions are a targeted discount, a bundle with a fast-moving product, liquidation to a clearance marketplace, or a donation write-off. OpenClaw can't make that decision — but having the list reliably every week means you actually act on it rather than leaving it to pile up.

Drafting supplier reorder messages

When the reorder calculator flags a SKU, OpenClaw can draft a purchase order message using your supplier contact details and the quantity calculation. You review and send it — OpenClaw never sends messages autonomously.

# AGENTS.md — po-drafter agent

agents:
  po-drafter:
    description: "Draft supplier purchase order messages for SKUs at reorder point"
    tools:
      - shopify-admin-api
      - file-reader              # reads supplier_contacts.csv
    config:
      platform: shopify
      credentials:
        store: "${SHOPIFY_STORE}"
        token: "${SHOPIFY_TOKEN}"
      supplier_contacts_file: "supplier_contacts.csv"  # columns: supplier_tag, name, email
      order_quantity_multiplier: 3   # order 3× avg monthly sales by default
    prompt: |
      For each SKU at its reorder point, draft a professional purchase order email.
      Include:
      - Subject: "Purchase Order — [product name] — [date]"
      - Greeting to the supplier by name
      - The SKU, product name, and variant clearly stated
      - The quantity requested (calculated from order_quantity_multiplier)
      - A request for lead time confirmation and invoice
      - Your store name as the sender
      Keep the tone professional and concise.
      Output each draft as a separate section with a clear "DRAFT FOR [supplier name]" header.
      Do NOT send the email — output drafts only.

HEARTBEAT.md templates

Daily morning stock check

# HEARTBEAT.md — daily stock check

schedule:
  - name: "Morning Stock Check"
    cron: "0 7 * * *"           # every day at 7 AM
    agents:
      - stock-monitor
      - reorder-calculator
    output:
      file: "daily_stock_report.md"
      notify: true
    prompt: |
      Combine the low-stock alert and reorder calculator outputs into a single
      morning briefing. Format:
      1. URGENT — Out of stock (zero inventory): list with SKU and product name
      2. WARNING — Below threshold: list with current qty and days remaining
      3. ACTION NEEDED — At reorder point: list with suggested order quantity
      Keep it scannable. If everything is fine, output a single line:
      "✓ All stock levels healthy — no action needed."

Weekly dead stock report

# HEARTBEAT.md — weekly dead stock

schedule:
  - name: "Weekly Dead Stock Report"
    cron: "0 8 * * 1"           # Mondays at 8 AM
    agents:
      - dead-stock-finder
    output:
      file: "weekly_dead_stock.md"
      notify: true

What the daily report looks like

━━ Morning Stock Check — 25 Mar 2026 ━━
🔴 OUT OF STOCK (2 SKUs)
· SKU-0042 | Classic Tee — Black / XL | 0 units
· SKU-0078 | Hoodie — Navy / S | 0 units

⚠️ BELOW THRESHOLD (3 SKUs)
· SKU-0015 | Classic Tee — White / M | 6 units | ~2 days remaining
· SKU-0033 | Cap — Logo Black | 4 units | ~5 days remaining
· SKU-0091 | Tote Bag — Natural | 8 units | ~4 days remaining

📦 REORDER SUGGESTED (2 SKUs)
· SKU-0019 | Classic Tee — Grey / L | 18 units | reorder point: 20 | suggest: order 60
· SKU-0055 | Hoodie — Forest / M | 22 units | reorder point: 25 | suggest: order 75

✓ All other 147 SKUs within healthy stock levels.

Frequently asked questions

How does OpenClaw connect to Shopify inventory?

Via the Shopify Admin REST API using a private app access token with read_inventory and read_products scopes. You generate the token once in your Shopify admin, store it in secrets.env, and OpenClaw calls the inventory levels endpoint on schedule.

Can OpenClaw alert me when a product goes out of stock?

Yes. Set your threshold to 0 in the stock-monitor config. Any variant at zero inventory is flagged in the highest-priority section of the daily report. You can also set per-tag thresholds so fast-moving products get earlier warnings.

What is a reorder point and how does OpenClaw calculate it?

A reorder point is the stock level that triggers a new order — calculated as (avg_daily_sales × lead_time_days) + safety_stock. OpenClaw derives average daily sales from your actual order history and combines it with the lead times you configure per supplier tag.

How does OpenClaw identify dead stock?

It queries your order history for the defined window (e.g. 60 days), finds variants with zero sales during that period, and cross-references against current inventory to confirm stock exists. Results are ranked by estimated tied-up capital (quantity × cost price) so you prioritise the most expensive dead stock first.