Use the WooCommerce REST API to manage products, orders, and customers from external applications and headless frontends.

Abdur Razzak
Full-Stack Web Developer
The WooCommerce REST API opens the door to building modern e-commerce experiences beyond the traditional WordPress dashboard. Whether you are syncing inventory with an ERP system, building a React-powered storefront, or automating order fulfillment, the REST API gives you programmatic access to every corner of your store. Introduced in WooCommerce 2.6 and significantly expanded since, the API follows REST conventions and returns JSON, making it compatible with virtually any programming language or framework. This guide walks you through authentication, the most important endpoints, and practical patterns for integrating WooCommerce into external applications.
WooCommerce supports two authentication methods. For HTTPS stores, consumer key and consumer secret pairs work over Basic Auth — generate them at WooCommerce > Settings > Advanced > REST API. For non-HTTPS environments, OAuth 1.0a is required. The OAuth flow involves signing each request with your consumer key and a generated signature. In practice, most developers use the simpler key-based authentication since production stores always run over HTTPS. Store your consumer key and secret in environment variables — never hardcode them in your application source. Each key pair can be scoped to read-only, write-only, or read-write access, which lets you follow the principle of least privilege.
The products endpoint at `/wp-json/wc/v3/products` supports full CRUD. Fetching all products returns a paginated array with fields including id, name, slug, type, status, price, stock_quantity, images, categories, and attributes. Creating a product requires at minimum a name and type. Use `regular_price` for simple products and configure `variations` for variable products. Updating a product uses PUT with only the changed fields. Deleting requires the `force` parameter to permanently remove rather than trash the item. Product images are referenced by URL and WooCommerce handles downloading and attaching them to the media library automatically on create.
The orders endpoint at `/wp-json/wc/v3/orders` is where fulfillment automation lives. Each order object contains billing and shipping addresses, line_items (with product_id, quantity, and subtotal), shipping_lines, tax_lines, fee_lines, coupon_lines, and a status field. Common statuses include pending, processing, on-hold, completed, cancelled, refunded, and failed. To update an order status from processing to completed, send a PUT request with `{"status":"completed"}`. You can also add order notes via `/wp-json/wc/v3/orders/{id}/notes`. For batch operations, the `/batch` sub-endpoint accepts create, update, and delete arrays in a single request, drastically reducing API calls for bulk order processing.
The customers endpoint lets you create accounts programmatically, useful for migrating users from another platform. POST to `/wp-json/wc/v3/customers` with email, first_name, last_name, username, and password. The response includes the customer id and a set_password_url you can email to the customer. You can also retrieve order history for a customer by filtering the orders endpoint with `customer={id}`. For store migrations, you can export all customers and their metadata with pagination: `GET /wp-json/wc/v3/customers?per_page=100&page=2`. Keep in mind that customer passwords cannot be read back — only written — so plan your migration strategy accordingly.
Instead of polling the API, use webhooks to receive real-time notifications when events occur. WooCommerce can send POST requests to your endpoint when orders are created or updated, products change, customers register, and more. Create a webhook at WooCommerce > Settings > Advanced > Webhooks, specifying a delivery URL and the topic to listen for. The webhook payload is the same JSON structure as the corresponding API response. Validate incoming webhooks by checking the `X-WC-Webhook-Signature` header — it is an HMAC-SHA256 hash of the payload using your webhook secret. Use webhook processing to trigger fulfillment workflows, send custom notifications, or sync order data to external systems without delay.
WooCommerce REST API requests run through WordPress and execute database queries. On shared hosting, aggressive API usage can slow down your store. To mitigate this, batch requests using the `/batch` endpoints, implement client-side caching with short TTLs for product data, and use the `_fields` parameter to request only the fields you need — for example `?_fields=id,name,price` dramatically reduces response size and processing time. If you are building a high-traffic headless store, consider running a dedicated WordPress instance solely for API purposes, separate from your public-facing frontend. WooCommerce also supports server-to-server authentication tokens for background processes that need to make API calls without user interaction.