Short answer: deploying WooCommerce with Claude Code means two jobs. First, Claude Code builds and changes your store’s code (child theme, custom plugins, config) on a local or staging copy, then ships it to live through Git and WP-CLI. Second, you connect Claude Code to the store itself over MCP so it can read and manage products and orders. This guide walks through both, step by step, without putting live orders at risk.
The 7 steps at a glance
- Install Claude Code on your machine.
- Spin up a local or staging copy of the store, never work on live.
- Put the store’s code in Git and add a
CLAUDE.mdwith your rules. - Connect Claude Code to WooCommerce over MCP.
- Have Claude Code build and test your changes.
- Deploy code to live with a scripted, backed-up release.
- Verify checkout, payments and orders after every release.
What “deploying WooCommerce with Claude Code” actually means
Claude Code is Anthropic’s agentic coding tool. It runs in your terminal (or the Claude desktop app), reads your project, edits files and runs commands such as WP-CLI. That makes it well suited to WooCommerce work, but a store is not an ordinary WordPress site: it keeps data in two places.
- Files in
wp-content: themes, plugins, uploads. Claude Code edits these directly, and they belong in Git. - The database: products, orders, customers and settings. Claude Code only reaches this through tools (WP-CLI, WC-CLI or MCP), and it is live data that changes every time someone buys.
The golden rule follows from that: code moves up from local to staging to live; data moves down, from live to staging for testing. You never push a staging database over a live store, because you would overwrite real orders.
What you need before you start
- A Claude subscription or Anthropic API account to sign in to Claude Code.
- A self-hosted WooCommerce store, plus SSH access to the server (or a host with staging and Git deploys).
- WP-CLI on your local machine and on the server.
- Node.js, for
wp-envlocal sites and the remote MCP proxy. - Git and a private repository for the store’s custom code.
Step 1: Install Claude Code
Use the native installer. On macOS, Linux or WSL:
curl -fsSL https://claude.ai/install.sh | bash
On Windows PowerShell:
irm https://claude.ai/install.ps1 | iex
Open a new terminal, run claude --version to confirm it worked, then run claude in your project folder and sign in. If anything looks wrong, claude doctor reports on your installation.
Step 2: Work on a local or staging copy, never live
Claude Code’s checkpoints can undo its own file edits, but not database changes or commands it runs against a server. So give it a copy to work on. The fastest local option is wp-env, which runs WordPress in Docker:
npx @wordpress/env start
npx @wordpress/env run cli wp plugin install woocommerce --activate
For realistic testing, pull a recent copy of the live database into staging, and anonymise customer data (names, emails, addresses) before it reaches a developer’s laptop. Switch payment gateways to test or sandbox mode on every non-live copy.
Step 3: Put the code in Git and write a CLAUDE.md
Version only what you own: your child theme, custom plugins and must-use plugins. Keep secrets and generated files out of the repository.
# .gitignore
wp-config.php
.env
.mcp.json
/wp-content/uploads/
/wp-content/cache/
/wp-content/upgrade/
*.sql
Claude Code reads a CLAUDE.md file at the start of every session, so it is the place to write down how your store works and what it must never do. A good starting point:
# CLAUDE.md
## Project
WooCommerce store. Custom code lives in wp-content/themes/shop-child
and wp-content/plugins/shop-custom. Do not edit WooCommerce core or
third-party plugins; use hooks and template overrides instead.
## Rules
- Work on the local wp-env site only. Never run commands against production.
- Never run `wp db import`, `wp search-replace` or delete orders without asking.
- Payment gateways stay in test mode outside production.
- Follow WordPress Coding Standards; run `composer lint` before committing.
## Testing
- `npx @wordpress/env run cli wp wc product list --user=admin`
- Place a test order through checkout after any cart/checkout change.
Step 4: Connect Claude Code to WooCommerce over MCP
MCP (Model Context Protocol) lets Claude Code work with the store’s data, not only its files. WooCommerce registers its abilities (product and order queries, creating and updating products, order status and notes) through the WordPress Abilities API. To expose them, install the free MCP Adapter plugin. The feature is in developer preview, so expect changes.
wp plugin install mcp-adapter --activate
Local site (through WP-CLI)
claude mcp add woocommerce_store -- \
wp --path=/path/to/your/wordpress/site \
mcp-adapter serve \
--server=mcp-adapter-default-server \
--user=admin
Staging or remote site (over HTTPS)
Create a dedicated WordPress user with only the capabilities Claude needs, add an Application Password in that user’s profile, then:
claude mcp add \
--env WP_API_URL=https://staging.yourstore.com/wp-json/mcp/mcp-adapter-default-server \
--env WP_API_USERNAME=claude-agent \
--env WP_API_PASSWORD='your-application-password' \
woocommerce_store \
-- npx -y @automattic/mcp-wordpress-remote@latest
Inside Claude Code, run /mcp to check the server is connected, then ask something like “list the ten products with the lowest stock”. On WooCommerce 11.3 and later, use the /wp-json/mcp/mcp-adapter-default-server endpoint; the older /wp-json/woocommerce/mcp endpoint has been removed.
If you’d rather not wire this up by hand, WooCommerce’s own “WooCommerce for Claude” extension generates a ready-made claude mcp add command from its settings screen, and several third-party MCP servers wrap the WooCommerce REST API instead.
Step 5: Let Claude Code build and test the change
Describe the outcome, not the code. Claude Code works best with one clear task at a time and a way to check the result. For example:
“Add a ‘Delivery date’ field to checkout in the shop-custom plugin, save it to the order, show it in the admin order screen and the customer email. Use WooCommerce hooks, support block checkout, then place a test order on the local site to prove it works.”
Review the diff before you commit. Claude Code asks for permission before running commands, and you can keep it in plan mode for larger changes so it proposes an approach before touching files.
Step 6: Deploy to live with a scripted release
Once the change is merged, ship code only, and always with a backup taken first. Ask Claude Code to write a deploy script like this one into your repository, then run it yourself or from CI (GitHub Actions, DeployHQ, or your host’s Git deploy):
#!/usr/bin/env bash
# scripts/deploy.sh — code goes up, data never does
set -euo pipefail
SSH_USER="deploy"
SSH_HOST="yourstore.com"
REMOTE="${SSH_USER}@${SSH_HOST}"
WP="/var/www/yourstore"
ssh "$REMOTE" "cd $WP && wp db export ~/backups/pre-deploy-$(date +%F-%H%M).sql"
ssh "$REMOTE" "cd $WP && wp maintenance-mode activate"
rsync -az --delete wp-content/themes/shop-child/ "$REMOTE:$WP/wp-content/themes/shop-child/"
rsync -az --delete wp-content/plugins/shop-custom/ "$REMOTE:$WP/wp-content/plugins/shop-custom/"
ssh "$REMOTE" "cd $WP && wp wc update && wp cache flush"
ssh "$REMOTE" "cd $WP && wp maintenance-mode deactivate"
Deploy during your quietest trading hour. Keep maintenance mode as short as possible: every minute in it is a minute nobody can check out.
Step 7: Verify after every release
- Place a real low-value order (or a 100% coupon order) through checkout and refund it.
- Check that the order email arrives and the order appears in the admin.
- Check WooCommerce → Status → Logs for fatal errors.
- Confirm payment gateways are in live mode on production.
- Watch the first few real orders after the release.
With the MCP connection pointed at production as a read-only user, you can ask Claude Code to do this check for you: “show me orders placed in the last hour and any that failed”.
Safety checklist for AI-assisted WooCommerce work
- Least privilege: give the MCP user only the capabilities it needs; read-only on production.
- No secrets in Git: never commit
.mcp.json, Application Passwords or API keys. - Personal data: orders contain names, emails and addresses. Anonymise copies and stay compliant with UK GDPR.
- HTTPS only for remote MCP connections, and revoke Application Passwords you no longer use.
- Human review: read every diff and approve every command that touches a server.
Frequently asked questions
Can Claude Code deploy WooCommerce on its own?
It can write and run the deploy script, but for a live store you should keep a human approval step. Claude Code asks before running commands by default; leave that on for anything that touches production.
Do I need a WooCommerce MCP server to use Claude Code?
No. For theme and plugin development Claude Code only needs your files and WP-CLI. MCP adds the ability to read and manage products and orders in natural language.
Is it safe to point Claude Code at a live store?
For reading data with a restricted user, yes with care. For code changes and database work, use staging. Claude Code’s checkpoints can undo file edits but not changes made to a database or remote server.
Does this work on managed WordPress hosting?
Yes, if the host offers SSH or Git deploys and a staging site. Swap the rsync lines for your host’s CLI or Git push, and keep the backup step.
Should I push my staging database to live?
No. Live receives new orders, customers and stock changes all the time. Overwriting it from staging loses that data. Move settings with code (or by hand), not by copying the database.
Want this set up for your store?
We’ll build your staging environment, Git workflow, MCP connection and a safe deploy pipeline, so you can use Claude Code on your WooCommerce store without risking a single order.

