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.
Published here , updated · 8 sources · Resume reading
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 for change packs, Claude Code for finance when margin math is the product. Browse the Claude Code topic.
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]
Profile catalog-2026-11-26.csv
Done when: duplicate SKUs = 0, blank titles = 0, price cents > 0Claude 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]
sku,field,old,new
SKU-100,title,Blue Shirt ,Blue Shirt
SKU-100,barcode,,012345678905Warning: 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]
def margin_cents(price_cents: int, cost_cents: int) -> int:
return price_cents - cost_centsYou 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]
stripe listen --forward-to localhost:3000/webhooks/stripeYou 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]
{
"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. For Decimal money math, use 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.
Keep this guide
Filed under Claude Code, Dev tools
Questions about this guide
Which store APIs should Claude talk to first?
Prefer documented Admin or Storefront APIs from your platform. For Shopify, new public apps must use GraphQL Admin (REST Admin is legacy as of 2024-10-01). Payment APIs such as PayPal stay read-first.
How do Stripe webhooks fit order checks?
Stripe's webhooks guide says registered HTTPS endpoints receive signed JSON events. Verify the signature, then reconcile event ids against your order table.
How do I stop Claude from writing live prices?
Use a PreToolUse hook that exits 2 when the Bash or Edit payload matches product update or price write paths. Hooks docs say exit 2 blocks the tool call.
Is the Operations plugin useful for catalog change packs?
Yes for /change-request and /runbook style packs around a big catalog cutover. Keep price writes behind the same hook gate.
Sources
- PayPal API overview, accessed 2026-11-26developer.paypal.com
- Stripe webhooks documentation, accessed 2026-11-26docs.stripe.com
- Claude Code best practices, accessed 2026-11-26code.claude.com
- Claude Code docs: Hooks, accessed 2026-11-26code.claude.com
- Anthropic Operations plugin README, accessed 2026-11-26raw.githubusercontent.com
- Full Byte Developer: Claude Code for operationsfullbytedeveloper.com
- Full Byte Developer: Claude Code for financefullbytedeveloper.com