woocommerce-rest-api
Skill1 starsChanged 18 days agoMITView on GitHub
Call the WooCommerce REST API at wc/v3, including authentication, pagination, batch writes, and webhook registration, and keep it separate from the Store API. Use when an external system integrates with a WooCommerce store over HTTP.
In this repository28 other files it gives its agents.
- b2b-pricingSkill
- catalog-import-and-migrationSkill
- checkout-ux-and-conversionSkill
- conversion-event-trackingSkill
- ecommerce-seo-structured-dataSkill
- fraud-and-risk-basicsSkill
- google-merchant-product-feedsSkill
- headless-nextjs-storefrontSkill
- inventory-and-multi-warehouseSkill
- iranian-payment-gatewaysSkill
- marketplace-search-and-rankingSkill
- mcp-store-toolingSkill
- multi-vendor-payoutsSkill
- order-and-webhook-reliabilitySkill
- payment-gateway-integrationSkill
- product-catalog-modelingSkill
- product-description-guardrailsSkill
- returns-and-refundsSkill
- rtl-and-persian-localizationSkill
- shopify-app-developmentSkill
- storefront-accessibilitySkill
- storefront-performanceSkill
- stripe-paymentsSkill
- subscription-billingSkill
- tax-and-shippingSkill
- vector-product-searchSkill
- woocommerce-plugin-developmentSkill
- wordpress-plugin-securitySkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 5 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Use this skill for a server-side client of a WooCommerce store.
- Distinctive: line 24
Never put a consumer secret in browser JavaScript, a mobile binary, or a Store API request.
- Distinctive: line 28
Create a key at WooCommerce > Settings > Advanced > REST API.
- Very specific: line 45
Follow pages with page and per_page.
- Very specific: line 57
Put your own key in meta, for example meta_data: [{ "key": "_idempotency_key", "value": "<key>" }].
- Distinctive: line 58
Before creating, search orders by that meta.
- Distinctive: line 63
Update orders and products with the resource id.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
WooCommerce REST API
Use this skill for a server-side client of a WooCommerce store. The browser checkout uses a different API. Payment notification handling belongs to the webhook reliability skill.
Which API
| API | Namespace | Who calls it |
| WooCommerce REST API | /wp-json/wc/v3/ | Your server, with a consumer key and secret. |
| Store API | /wp-json/wc/store/v1/ | The storefront, with a cart token and nonce. |
| Legacy REST API | /wc-api/v3/ | Old clients only. Do not start new work here. |
The current REST API requires WooCommerce 3.5+, WordPress 4.4+, and pretty permalinks. Default permalinks do not serve these routes.
Never put a consumer secret in browser JavaScript, a mobile binary, or a Store API request.
Authentication
Create a key at WooCommerce > Settings > Advanced > REST API. The key inherits the WordPress user you bind it to, and the permission you select: Read, Write, or Read/Write. Deleting that user disables the key. The consumer secret is shown once.
Over HTTPS, send HTTP Basic authentication with the consumer key as the username and the consumer secret as the password.
curl --user "$WC_CONSUMER_KEY:$WC_CONSUMER_SECRET" \
"https://shop.example/wp-json/wc/v3/orders?per_page=20"Some FastCGI hosts drop the Authorization header and WooCommerce then reports that the consumer key is missing. Only then, and only over HTTPS, send consumer_key and consumer_secret as query parameters. Query secrets land in access logs and caches. Prefer fixing the host header.
Over plain HTTP, WooCommerce expects one-legged OAuth 1.0a. For a new integration, use HTTPS instead of adding an OAuth client.
Store the secret in the server environment or a secret manager. Do not commit it.
Reads
- Follow pages with
pageandper_page.per_pageabove 100 is rejected. ReadX-WP-TotalandX-WP-TotalPages. - Request only the fields you need when the endpoint supports
_fields. - Compare instants with
date_created_gmtanddate_modified_gmt. The unsuffixed fields are in the site timezone. - Product variations are a child resource:
/wp-json/wc/v3/products/<id>/variations. - Error bodies use the WordPress shape
{ "code", "message", "data": { "status" } }. Branch oncodeand HTTP status, not on the message string.
Endpoint groups and the batch body are in the endpoint notes.
Writes
The REST API does not provide a general idempotency key. A retried POST /orders can create a second order.
- Put your own key in meta, for example
meta_data: [{ "key": "_idempotency_key", "value": "<key>" }]. - Before creating, search orders by that meta. Treat a hit as the original result.
- Meta search is not a unique index. Two concurrent creates can still both miss. For payments, dedupe on the provider transaction id as well. See the order and webhook skill.
Batch routes (POST /products/batch, /orders/batch, and the customer and coupon equivalents) accept create, update, and delete. The batch is not one database transaction. Read each item result. A 200 response can still contain per-item errors.
Update orders and products with the resource id. Do not match a later update on SKU alone unless you have already resolved the SKU to one id. SKUs can change.
Webhooks registered over REST
POST /wp-json/wc/v3/webhooks with name, topic, delivery_url, and secret. The secret is write-only on later reads. If you omit it, WooCommerce falls back to the API user's consumer secret. Set an explicit secret.
The first save of an active webhook delivers a ping, not a full order or product. Acknowledge that ping with a 2xx response and do not create an order from it.
Topic names look like order.updated and product.created. The delivered resource body matches the REST representation. Verify X-WC-Webhook-Signature against the raw body before trusting it. The signature procedure is in the order and webhook skill.
Gotchas
- A Read key cannot create products. A Write key cannot list orders. Check the key permission and the user's capability when you get
401or403. - Order status names in the API omit the
wc-prefix (processing, notwc-processing). - Prices are strings in major currency units, such as
"19.00". Do not send a float. - HPOS does not change the REST shape. Clients should keep using this API rather than reading the database.
- Webhook delivery that returns
301or302can be counted as success whileWC_Webhook::deliver()sends the body with redirects disabled. Serve the JSON handler on the exactdelivery_url.
Verification
- A request with the wrong secret returns 401 and creates nothing.
- Listing orders walks every
X-WP-TotalPagespage without duplicating or skipping ids. - Repeating the same create with the same idempotency key returns one order.
- A webhook ping does not create an order. A signed
order.updateddelivery updates the matching local record.
Evaluation
Worked examples and the checks they must satisfy are in evals/tasks.json.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

