---
name: shopify-low-stock-alert
description: "Every weekday: Shopify variants below your stock threshold, with days of stock left at the current sales pace, and a question about what to reorder. Use when the user asks for this, or when it runs on a schedule."
---

# Shopify low stock alert

Every weekday: Shopify variants below your stock threshold, with days of stock left at the current sales pace, and a question about what to reorder.

A stock count on its own says little. Six units of a bowl that sells three a day is an emergency; six units of a throw that sells one a week is fine. Shopify shows the count and leaves the pace to you.

This skill puts the two together for every tracked variant under your threshold, skips the ones with a delivery already on the way, and asks before anything happens. The answer can be as simple as "draft the reorder email to the supplier".

## Two ways to get the data

Use the API or MCP route when you have an MCP server, a CLI or an API token for the app. Otherwise, if you can drive a browser the user is signed in to (Claude in Chrome, a Playwright or Chrome DevTools MCP server), use the browser route. Say which one you used.

## Route A: API or MCP server

### What you need

- A Shopify custom app token with `read_products`, `read_inventory` and `read_orders` in `SHOPIFY_ADMIN_TOKEN`, or a Shopify connector that can query inventory.
- Your threshold, if 10 units is wrong for your catalog, and each product's supplier if you want the reorder drafted.

If something is missing, say what and stop; do not invent numbers.

### Steps

1. **Find the low variants** (Shopify): Query `productVariants(first: 250, query: "inventory_quantity:<10 product_status:active")` with `displayName`, `sku`, `inventoryQuantity` and `inventoryItem { tracked inventoryLevels(first: 10) { nodes { location { name } quantities(names: ["available", "incoming"]) { name quantity } } } }`.
2. **Measure the sales pace** (Shopify): Pull orders from the last 28 days, for example `orders(query: "created_at:>=2026-09-18")`, skip canceled and test orders, and sum `lineItems.quantity` by `variant.id`.
3. **Work out days left**: Days left is available stock divided by the daily pace (units sold in 28 days divided by 28). Flag variants under the threshold or under 14 days, and leave out any whose `incoming` quantity already covers the next 30 days.
4. **Ask what to reorder**: Post the list by days left and ask what to do. On a yes, draft the reorder (variant, SKU, a quantity for 45 days of sales) as an email to the supplier or a purchase order note, and change nothing in Shopify.

## Route B: the browser

### What you need

- Signed in to Shopify as the owner or a staff member with **Products**, **Inventory** and **Reports** permissions, with the store chosen if the account has several.

If something is missing, say what and stop; do not invent numbers.

### Steps

Start at https://admin.shopify.com/. The user is signed in already; never type passwords or codes, and ask if a sign-in page appears.

1. **List the low variants**: Open the store from admin.shopify.com, then **Products > Inventory**. Pick **All locations** in the location picker, add a filter on **Quantity** with **Available** less than `10`, and sort by Available ascending. Read each variant's SKU, available and the **Incoming** column.
2. **Get the sales pace**: Go to **Analytics > Reports** and open **Sales by product variant SKU**. Set the date to **Last 30 days** and read **Net items sold** for each SKU from step 1; the search box on the report finds a SKU quickly.
3. **Work out days left**: Days left is available divided by the daily pace (items sold divided by 30). Keep variants under 14 days or under the threshold, and drop any whose incoming stock covers the next 30 days. Shopify's own **Days of inventory remaining** tile on the Products page gives a cross-check.
4. **Ask before anything is ordered**: List the variants by days left with a reorder quantity for 45 days of sales and ask what to do. On a yes, the agent drafts the reorder email or purchase order text; it changes nothing in Shopify.

Note: The Inventory page lists variants 50 at a time; a catalog with hundreds of low variants is quicker through the API. The sales report uses the last 30 days where the API route uses 28, so days left can differ by a few percent. Variants that don't track inventory show no quantity and are left out.

## The report

- How many variants are under the threshold, and which runs out first.
- Per variant: available, units sold in 28 days, days of stock left.
- A suggested reorder quantity covering 45 days of sales.
- The question: draft the reorder, change the threshold, or leave it.

## Post it to Briefkin

When `BRIEFKIN_TOKEN` is set, or `~/.config/briefkin/env` exists (the installer from https://briefkin.dev/docs writes it), also send the result to the user's Briefkin board as one card. Keep the `item_key` the same on every run so the card updates in place, use a new `event_id` per run, and put today's real numbers in place of the example ones. If the request fails, say so once and carry on.

```bash
[ -n "${BRIEFKIN_TOKEN:-}" ] || . ~/.config/briefkin/env
curl -sS -X POST "${BRIEFKIN_URL:-https://briefkin.dev}/v1/events" \
  -H "authorization: Bearer $BRIEFKIN_TOKEN" \
  -H "content-type: application/json" \
  -d @- <<'JSON'
{
  "v": 1,
  "event_id": "shopify-low-stock-alert/<date of this run, e.g. 2026-10-16>",
  "item_key": "shopify-low-stock-alert",
  "project": "Acme Store",
  "source": "Shopify low stock alert skill",
  "kind": "action",
  "title": "5 variants low on stock, 2 out within 4 days",
  "summary": "**5** variants are under 10 units. Stoneware bowl (Speckled) sells out in about **2 days**.",
  "action": {
    "request": "Should I draft a reorder for these variants?",
    "options": [
      "Draft reorder for all 5",
      "Only the 2 under a week",
      "Raise threshold to 20 units",
      "Not now"
    ]
  },
  "widget": {
    "type": "Table",
    "props": {
      "columns": [
        "Variant",
        "Available",
        "Sold in 28 days",
        "Days left",
        "Reorder"
      ],
      "align": [
        "left",
        "right",
        "right",
        "right",
        "right"
      ],
      "rows": [
        [
          "Stoneware bowl / Speckled",
          6,
          84,
          2,
          135
        ],
        [
          "Espresso cup / Sage",
          9,
          63,
          4,
          101
        ],
        [
          "Wool throw / Mustard",
          4,
          14,
          8,
          23
        ],
        [
          "Canvas apron / Rust",
          8,
          22,
          10,
          35
        ],
        [
          "Brass candle holder",
          7,
          12,
          16,
          19
        ]
      ]
    }
  }
}
JSON
```

Widgets come from the Briefkin catalog (https://briefkin.dev/v1/catalog). Without a token, just give the user the report.

## Run it on a schedule

Suggested: Weekdays at 9:00 (`0 9 * * 1-5`). From cron, with the agent signed in on that machine:

```bash
0 9 * * 1-5 claude -p "Run the shopify-low-stock-alert skill"
# Codex: codex exec, Gemini CLI: gemini -p, Copilot CLI: copilot -p, OpenCode: opencode run
```

Or use the agent's own scheduler (Claude Code routines, Codex automations, Claude or ChatGPT scheduled tasks): https://briefkin.dev/skills/shopify-low-stock-alert#schedule

Source: https://briefkin.dev/skills/shopify-low-stock-alert
