Want to add products to your WooCommerce store without entering each one by hand? The WooCommerce REST API makes it possible to create products programmatically, saving time and helping you manage your catalog more efficiently.
In this guide, you’ll learn how to use the WooCommerce REST API to create products, including the key details and steps to get started. Whether you’re adding a single item or automating a larger catalog, WooCommerce REST API create products workflows can make the process straightforward.
WooCommerce REST API: Create Products with the Right Setup
Before sending your first product request, take a moment to check the store’s settings and decide what you’re selling. A little preparation now can prevent authentication errors and product data that needs fixing later.
Start by confirming that your store exposes the right API version and that its REST API is available. These checks help ensure your integration is using an endpoint WooCommerce recognizes.
Check your WooCommerce version and REST API settings
WooCommerce’s current REST API uses version 3, with product requests sent to /wp-json/wc/v3/products on your site. Check that WooCommerce is up to date and that your server supports HTTPS; encrypted connections protect credentials and store data in transit.
You can also test whether the API responds by opening https://yourstore.com/wp-json/wc/v3/ in a browser. A response—or an authentication message—usually indicates the route is reachable. If you see a 404, check your site’s permalink settings and confirm that REST API access isn’t being blocked by a security plugin or hosting rule.
Once the endpoint is reachable, your integration needs permission to make changes. WooCommerce API keys connect requests to a store user’s permissions, so create them for an account with only the access the integration actually needs.
Generate API keys and choose an authentication method
In your WordPress dashboard, go to WooCommerce → Settings → Advanced → REST API, create a key, and select the appropriate user and permissions. For product creation, choose Read/Write. Copy the consumer key and secret when they appear; the secret is shown only once.
For most server-to-server connections, use HTTPS with Basic Authentication, passing the consumer key and secret securely. Keep credentials out of browser code, public repositories, and logs. Store them in environment variables or a secrets manager, and regenerate them if they’re exposed.
With access in place, map your catalog data to WooCommerce’s product model before building the request. The product type determines which fields you’ll need and whether additional API calls are involved.
Understand product types and required fields
A basic item is usually a simple product; a product with selectable options, such as size or color, is typically variable. WooCommerce also supports grouped products and external or affiliate products, each with different setup needs.
For a straightforward creation request, provide a name and the product type, then add relevant details such as regularprice, description, sku, categories, and images. For variable products, define attributes on the parent product and create its variations separately. Check that SKUs are unique, and include only fields that apply to the chosen type—this makes your WooCommerce REST API create products workflow easier to validate.
WooCommerce REST API: Create Products with a Well-Formed Request
Once your catalog details are mapped, the next step is turning them into a request WooCommerce can process. A clear endpoint and carefully structured payload make it easier to spot mistakes before they affect your storefront.
First, match the request method to the action you want to perform. The endpoint stays consistent for standard products, while the payload determines what WooCommerce creates.
Choose the endpoint and HTTP method
To create a product, send a POST request to https://yourstore.com/wp-json/wc/v3/products. Include your authentication details securely, and set the request’s Content-Type header to application/json.
For example, a server-side request might use POST with a JSON body and Basic Authentication over HTTPS. Avoid sending credentials from front-end JavaScript; requests from a server keep secret keys out of customers’ browsers. A successful creation typically returns the new product’s data, including its WooCommerce ID, which you can save for later updates or variation requests.
With the route established, build a JSON object from the fields that apply to the item. Start with the essentials, then add optional details that help customers understand and find the product.
Build your product data payload
Here’s a compact example for a simple product:
{
"name": "Everyday Canvas Tote",
"type": "simple",
"regularprice": "24.00",
"description": "A reusable cotton canvas tote.",
"sku": "TOTE-001",
"status": "draft"
}Prices should be sent as strings, and the product’s type should match its setup. You can also include fields such as shortdescription, weight, and tags. Setting status to draft is useful when you want to review the listing before publishing it.
After the basic listing is in place, add the selling details customers rely on. These fields can also connect a product to existing store records, so use their WooCommerce IDs where required.
Add prices, inventory, categories, images, and variations
For stock tracking, include fields such as managestock, stockquantity, and stockstatus. Add categories as an array of objects containing category IDs, and provide image URLs in an images array; WooCommerce can fetch images from accessible URLs.
A variable product needs attributes on its parent, with variation set to true for options customers can select. Create each purchasable combination separately using POST /products/{product_id}/variations, supplying its attribute values, price, and any stock details. For reliable WooCommerce REST API create products workflows, validate the response and check the product in your dashboard before sending a large batch.
Verify and Troubleshoot Your WooCommerce Product Creation
A successful request is a good start, but it doesn’t guarantee the listing is ready for customers. A quick check of the API response and storefront can catch issues before they affect orders or inventory.
Begin with the response WooCommerce sends back: it can confirm whether the item was created and point to fields that need attention. The status code and returned data together are more useful than either one alone.
Send the request and review the response
A successful creation usually returns a 201 Created status and a JSON object containing the new product’s ID, status, and other saved details. Store that ID in your integration so you can refer to the item in later updates or variation requests.
If the request fails, inspect the response body for an error code and message. Common HTTP statuses include:
- 400 Bad Request: the data may be invalid, incomplete, or incompatible with the product type.
- 401 Unauthorized or 403 Forbidden: check the credentials, key permissions, and authentication setup.
- 404 Not Found: verify the site URL and API route.
- 429 Too Many Requests: slow down and retry after a pause if your server or API layer applies rate limits.
Compare the returned fields with the values you intended to send. WooCommerce may apply defaults or normalize data, so the response is a useful record of what was actually saved.
Next, view the item as a shopper would—not only in the dashboard. This helps reveal display or purchasing problems that a successful API response won’t show.
Test the product in your store
Open the product page and check its title, price, images, descriptions, and visibility. If it is still a draft or private, it won’t appear to ordinary visitors; confirm the status is appropriate before expecting customers to find it.
When relevant, test the buying process too. Confirm that stock behavior is correct, categories and options display as expected, and a variable product’s selections lead to the right price and availability. A brief review on mobile can also catch layout issues.
If something is off, narrow down the cause before changing several fields at once. A consistent testing routine makes WooCommerce REST API create products integrations easier to maintain as your catalog grows.
Fix common errors and improve your workflow
Check for duplicate SKUs, incorrect IDs for categories, inaccessible image URLs, and values that don’t match the chosen product type. Keep a record of the request, response, and timestamp, but never log API secrets.
For larger imports, test a small batch first, validate each response, and record failed items for review. Use retries carefully: after a timeout, check whether the product was created before resending the request, or you could create duplicates.
Turn Product Creation into a Smoother WooCommerce Workflow
The WooCommerce REST API can make adding products faster and easier to manage, whether you’re creating a single listing or building a larger catalog. The key is to prepare your store access, send product data that matches the item you’re creating, and check the results before relying on the workflow at scale.
With secure credentials, careful validation, and a little testing, WooCommerce REST API create products workflows can help reduce repetitive work while keeping your catalog accurate. Start small, refine your process, and let automation take more of the busywork off your hands.