# Claude Code for ecommerce: feeds, SKUs, price gates

> Clean catalog feeds and SKUs with Claude, validate margins offline, and block live price writes until a person signs.

Source: https://fullbytedeveloper.com/blog/claude-code-for-ecommerce
Published here: 2026-11-26, updated 2026-11-26

Ecommerce with Claude Code stays safe when catalog cleanup and margin math stay offline, and live price or inventory writes need a human. Prefer Shopify GraphQL Admin for new public apps; REST Admin is legacy as of 2024-10-01 with GraphQL-only for new public apps from 2025-04-01. [1] [2]

After this page you can export a checked catalog feed, clean SKUs with a dry-run patch, validate margin offline, reconcile Stripe webhook events, and block live price writes with a PreToolUse hook. Related: [Claude Code for operations](/blog/claude-code-for-operations) for change packs, [Claude Code for finance](/blog/claude-code-for-finance) when margin math is the product. Browse the [Claude Code topic](https://fullbytedeveloper.com/blog/topic/claude-code).

## Export the catalog feed into a checked workspace

Pull a feed or Admin export into a dated folder. Ask Claude to profile SKU uniqueness, missing images, zero prices, and orphan variants against your platform's product shape. Shopify's legacy Admin REST docs still describe product and variant resources for that shape; prefer GraphQL Admin for new public apps. [1]

```text
Profile catalog-2026-11-26.csv
Done when: duplicate SKUs = 0, blank titles = 0, price cents > 0
```

Claude Code best practices say to give Claude a check so "done" is measurable. Put that check in a script Claude can re-run. [4]

You should see a CSV or JSON report of bad rows before anyone opens the Admin UI.

## Clean SKUs with a dry-run patch file

Have Claude emit a patch file (SKU, field, old, new) instead of calling the write API. Review the patch, then apply from a separate allowlisted command you run yourself. PayPal or Shopify write calls stay out of the agent session until that review. [1] [2] [4]

```text
sku,field,old,new
SKU-100,title,Blue Shirt  ,Blue Shirt
SKU-100,barcode,,012345678905
```

**Warning:** never paste production Admin tokens into a session that also has broad Bash allow. Prefer sandbox shops first. [1] [4]

## Validate margin and pricing offline

Compute contribution margin in integer cents from cost and list price columns. Fail the job if any SKU prices below cost plus your floor, or if currency codes mix in one feed. Keep the script next to the feed so Claude can re-run after each cleanup. [4]

```python
def margin_cents(price_cents: int, cost_cents: int) -> int:
    return price_cents - cost_cents
```

You should print a floor-breach list Claude cannot "fix" by editing live prices.

## Reconcile orders with Stripe webhook events

Stripe documents HTTPS webhook endpoints that receive signed JSON events, with a signing secret beginning with `whsec_`. Verify signatures, store event ids, and match `checkout.session.completed` or `payment_intent.succeeded` to your order rows. Ask Claude to write the verifier and the idempotency check, not to replay live events by hand. [3]

```bash
stripe listen --forward-to localhost:3000/webhooks/stripe
```

You should see duplicate deliveries ignored by event id, and unknown signatures rejected.

## Block live price writes with a PreToolUse hook

Hooks fire before tool calls. A `PreToolUse` handler that exits 2 blocks the call and returns stderr as the reason. Match Admin product update, price mutate, or bulk edit commands and refuse them in production repos. [5]

```json title=".claude/settings.json"
{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "scripts/block-live-price-writes.sh"
          }
        ]
      }
    ]
  }
}
```

For large cutovers, draft `/change-request` and `/runbook` packs with the Operations plugin, then apply prices only after sign-off. [6]

For ops-shaped packs, continue on [Claude Code for operations](/blog/claude-code-for-operations). For Decimal money math, use [Claude Code for finance](/blog/claude-code-for-finance). [7] [8]

You now have an ecommerce loop: feed profile, SKU patch dry-run, offline margin gate, Stripe event reconcile, hook-blocked live price writes.

Send this to the merchant engineer who wants Claude cleaning catalogs without writing live prices.

## Sources

1. [Shopify Admin REST API (legacy as of 2024-10-01), accessed 2026-11-26](https://shopify.dev/docs/api/admin-rest)
2. [PayPal API overview, accessed 2026-11-26](https://developer.paypal.com/docs/api/overview/)
3. [Stripe webhooks documentation, accessed 2026-11-26](https://docs.stripe.com/webhooks)
4. [Claude Code best practices, accessed 2026-11-26](https://code.claude.com/docs/en/best-practices)
5. [Claude Code docs: Hooks, accessed 2026-11-26](https://code.claude.com/docs/en/hooks)
6. [Anthropic Operations plugin README, accessed 2026-11-26](https://raw.githubusercontent.com/anthropics/knowledge-work-plugins/main/operations/README.md)
7. [Full Byte Developer: Claude Code for operations](https://fullbytedeveloper.com/blog/claude-code-for-operations)
8. [Full Byte Developer: Claude Code for finance](https://fullbytedeveloper.com/blog/claude-code-for-finance)
