NAV
cURL Node.js Python PHP Ruby

Introduction

Introduced in WooCommerce 2.1, the REST API allows store data to be created, read, updated, and deleted using the JSON format.

Requirements

You must be using WooCommerce 2.1 or newer and the REST API must be enabled under WooCommerce > Settings. You must enable pretty permalinks, as default permalinks will not work.

Version

The current API version is v3 which takes a first-order position in endpoints.

Check the API versions present in every version of WooCommerce:

API Version WooCommerce
v1 2.1.x, 2.2.x, 2.3.x and 2.4.x
v2 2.2.x, 2.3.x and 2.4.x
v3 2.4.x

The v1 and v2 will be removed in future versions.

Differences between v1 and v2 versions

Differences between v3 and old versions

API Docs for each version

Schema

The API is accessible via this endpoint:

https://www.your-store.com/wc-api/v2

You may access the API over either HTTP or HTTPS. HTTPS is recommended where possible, as authentication is simpler. The API index will declare if the site supports SSL or not.

Requests/Responses

The default response format is JSON. Requests with a message-body use plain JSON to set or update resource attributes. Successful requests will return a 200 OK HTTP status.

Some general information about responses:

Authentication

There are two aways to authenticate with the API, depending on whether the site supports SSL or not. Remember that the Index endpoint will indicate if the site supports SSL or not.

Over HTTPS

You may use HTTP Basic Auth by providing the API Consumer Key as the username and the API Consumer Secret as the password.

HTTP Basic Auth example

curl https://www.example.com/wc-api/v2/orders \
    -u consumer_key:consumer_secret

Occasionally some servers may not properly parse the Authorization header (if you see a “Consumer key is missing” error when authenticating over SSL, you have a server issue). In this case, you may provide the consumer key/secret as query string parameters.

Example for servers that not properly parse the Authorization header:

curl https://www.example.com/wc-api/v2/orders?consumer_key=123&consumer_secret=abc

Over HTTP

You must use OAuth 1.0a “one-legged” authentication to ensure API credentials cannot be intercepted. Typically you may use any standard OAuth 1.0a library in your language of choice to handle the authentication, or generate the necessary parameters by following these instructions.

Generating an OAuth signature

1) Set the HTTP method for the request:

GET

2) Set your base request URI – this is the full request URI without query string parameters – and URL encode according to RFC 3986:

http://www.example.com/wc-api/v1/orders

when encoded:

http%3A%2F%2Fwww.example.com%2Fwc-api%2Fv1%2Forders

3) Collect and normalize your query string parameters. This includes all oauth_* parameters except for the signature. Parameters should be normalized by URL encoding according to RFC 3986 (rawurlencode in PHP) and percent(%) characters should be double-encoded (e.g. % becomes %25.

4) Sort the parameters in byte-order (uksort( $params, 'strcmp' ) in PHP)

5) Join each parameter with an encoded equals sign (%3D):

oauth_signature_method%3DHMAC-SHA1

6) Join each parameter key/value with an encoded ampersand (%26):

oauth_consumer_key%3Dabc123%26oauth_signature_method%3DHMAC-SHA1

7) Form the string to sign by joining the HTTP method, encoded base request URI, and encoded parameter string with an unencoded ampersand symbol (&):

GET&http%3A%2F%2Fwww.example.com%2Fwc-api%2Fv1%2Forders&oauth_consumer_key%3Dabc123%26oauth_signature_method%3DHMAC-SHA1

8) Generate the signature using the string to key and your consumer secret key

If you are having trouble generating a correct signature, you’ll want to review your string to sign for errors with encoding. The authentication source can also be helpful in understanding how to properly generate the signature.

OAuth Tips

Parameters

All endpoints accept optional parameters which can be passed as an HTTP query string parameter, e.g. GET /orders?status=completed. There are common parameters and endpoint-specific parameters which are documented along with that endpoint.

Filter Parameter

All endpoints accept a filter parameter that scopes individual filters using brackets, like date filtering:

GET /orders?filter[created_at_min]=2013-11-01

Multiple filter parameters can be included and intermixed with other parameters:

GET /orders?status=completed&filter[created_at_min]=2013-11-01&filter[created_at_max]=2013-11-30

Note that the following filters are supported for all endpoints except the reports endpoint, which has it’s own set of filters that are documented along with that endpoint.

Available Filters

Filter Description
created_at_min given a date, only resources created after the provided date will be returned
created_at_max given a date, only resources created before the provided date will be returned
updated_at_min given a date, only resources updated after the provided date will be returned
updated_at_max given a date, only resources updated before the provided date will be returned
q performs a keyword search and returns resources that match, e.g. GET /products?filter[q]=search-keyword. Note that search terms should be URL-encoded as they will be decoded internally with urldecode
order controls the ordering of the resources returned, accepted values are ASC (default) or DESC
orderby controls the field that is used for ordering the resources returned. Accepts the same arguments as WP_Query. Defaults to date. You can order by meta_value but you must provide orderby_meta_key
orderby_meta_key the meta key to order returned resources by when using orderby=meta_value. For example, you could order products by price using GET /products?filter[orderby]=meta_value_num&filter[orderby_meta_key]=_price
post_status limits resources to only those with the specified post status. Most useful for returning unpublished products, e.g. GET /products?filter[post_status]=draft
meta resource meta is excluded by default, but it can be included by setting meta=true, e.g. GET /orders?filter[meta]=true. Protected meta (meta whose key is prefixed with an underscore) is not included in the response
pagination explained below

Note that Dates should be provided in RFC3339 format in UTC timezone: YYYY-MM-DDTHH:MM:SSZ. You may omit the time and timezone if desired.

Fields Parameter

You may limit the fields returned in the response using the fields parameter:

GET /orders?fields=id

To include multiple fields, separate them with commas:

GET /orders?fields=id,status

You can specify sub-fields using dot-notation:

GET /orders?fields=id,status,payment_details.method_title

Sub-fields can’t be limited for resources that have multiple structs, like an order’s line items. For example, this will return just the line items, but each line item will have the full set of information, not just the product ID:

GET /orders?fields=line_items.product_id

Pagination

Requests that return multiple items will be paginated to 10 items by default. This default can be changed by the site administrator by changing the posts_per_page option. Alternatively the items per page can be specifed with the ?filter[limit] parameter:

GET /orders?filter[limit]=15

You can specify further pages with the ?page parameter:

GET /orders?page=2

You may also specify the offset from the first resource using the ?filter[offset] parameter:

GET /orders?filter[offset]=5

Page number is 1-based and ommiting the ?page parameter will return the first page.

The total number of resources and pages are always included in the X-WC-Total and X-WC-TotalPages HTTP headers.

Pagination info is included in the Link Header. It’s recommended that you follow these values instead of building your own URLs where possible.

Link: <https://www.example.com/wc-api/v1/products?page=2>; rel="next",
<https://www.example.com/wc-api/v1/products?page=3>; rel="last"`

Linebreak included for readability

The possible rel values are:

Value Description
next Shows the URL of the immediate next page of results
last Shows the URL of the last page of results
first Shows the URL of the first page of results
prev Shows the URL of the immediate previous page of results

Errors

Occasionally you might encounter errors when accessing the API. There are four possible types:

400 Bad Request example:

{
  "errors" : [
    {
      "code" : "woocommerce_api_unsupported_method",
      "message" : "Unsupported request method"
    }
  ]
}

401 Unauthorized example:

{
  "errors" : [
    {
      "code" : "woocommerce_api_authentication_error",
      "message" : "Consumer Key is invalid"
    }
  ]
}

404 Not Found example:

{
  "errors" : [
    {
      "code" : "woocommerce_api_invalid_order",
      "message" : "Invalid order"
    }
  ]
}

500 Internal Server Error example:

{
  "errors" : [
    {
      "code" : "woocommerce_api_invalid_handler",
      "message" : "The handler for the route is invalid"
    }
  ]
}

Errors return both an appropriate HTTP status code and response object which contains a code and message attribute. If an endpoint has any custom errors, they are documented with that endpoint.

HTTP Verbs

The API uses the appropriate HTTP verb for each action:

Verbe Description
HEAD Can be used for any endpoint to return just the HTTP header information
GET Used for retrieving resources
PUT Used for updating resources
POST Used for creating resources
DELETE Used for deleting resources

JSONP Support

The API supports JSONP by default. JSONP responses uses the application/javascript content-type. You can specify the callback using the ?_jsonp parameter for GET requests to have the response wrapped in a JSON function:

GET
/wc-api/v2/orders/count?_jsonp=ordersCount
curl https://example.com/wc-api/v2/orders/count?_jsonp=ordersCount \
    -u consumer_key:consumer_secret

Response:

\**\ordersCount({"count":8})

If the site administrator has chosen to disable it, you will receive a 400 Bad Request error:

{
  "errors": [
    {
      "code": "woocommerce_api_jsonp_disabled",
      "message": "JSONP support is disabled on this site"
    }
  ]
}

If your callback contains invalid characters, you will receive a 400 Bad Request error:

{
  "errors": [
    {
      "code": "woocommerce_api_jsonp_callback_invalid",
      "message": "The JSONP callback function is invalid"
    }
  ]
}

Webhooks

Webhooks are an experimental feature in the v2 REST API. They must be managed using the REST API endpoints as a UI is not yet available. The WC_Webhook class manages all data storage/retrieval from the custom post type, as well as enqueuing a webhook’s actions and processing/delivering/logging the webhook. On woocommerce_init, active webhooks are loaded and their associated hooks are added.

Each webhook has:

Topics

The topic is a combination resource (e.g. order) and event (e.g. created) and maps to one or more hook names (e.g. woocommerce_checkout_order_processed). Webhooks can be created using the topic name and the appropriate hooks are automatically added.

Core topics are:

Custom topics can also be used which map to a single hook name, so for example you could add a webhook with topic action.woocommerce_add_to_cart that is triggered on that event. Custom topics pass the first hook argument to the payload, so in this example the cart_item_key would be included in the payload.

Delivery/Payload

Delivery is done using wp_remote_post() (HTTP POST) and processed in the background by default using wp-cron. A few custom headers are added to the request to help the receiver process the webhook:

The payload is JSON encoded and for API resources (coupons,customers,orders,products), the response is exactly the same as if requested via the REST API.

Logging

Requests/responses are logged as comments on the webhook custom post type. Each delivery log includes:

Only the 25 most recent delivery logs are kept in order to reduce comment table bloat.

After 5 consecutive failed deliveries (as defined by a non HTTP 2xx response code), the webhook is disabled and must be edited via the REST API to re-enable.

Delivery logs can be fetched through the REST API endpoint or in code using WC_Webhook::get_delivery_logs()

Endpoints

See the webhook resource section.

Troubleshooting

Official Libraries

// Install:
// npm install --save woocommerce-api

// Setup:
var WooCommerceAPI = require('woocommerce-api');

var WooCommerce = new WooCommerceAPI({
  url: 'http://example.com', // Your store URL
  consumerKey: 'consumer_key', // Your consumer key
  consumerSecret: 'consumer_secret', // Your consumer secret
  version: 'v2' // WooCommerce API version
});
# Install:
# pip install woocommerce

# Setup:
from woocommerce import API

wcapi = API(
    url="http://example.com",
    consumer_key="consumer_key",
    consumer_secret="consumer_secret",
    version="v2"
)
<?php
// Install:
// composer require "woothemes/woocommerce-api:2.*"

// Setup:
include_once('vendor/autoload.php');

$woocommerce = new WC_API_Client(
    'http://example.com/',
    'consumer_key',
    'consumer_secret'
);
?>
# Install:
# gem install woocommerce_api

# Setup:
require "woocommerce_api"

woocommerce = WooCommerce::API.new(
  "http://example.com",
  "consumer_key",
  "consumer_secret",
  {
    version: "v2"
  }
)

Tools

Index

The API index provides information about the endpoints available for the site, as well as store-specific information. No authentication is required to access the API index, however if the REST API is disabled, you will receive a 404 Not Found error.

404 Not Found response:

{
  "errors" : [
    {
      "code" : "woocommerce_api_disabled",
      "message" : "The WooCommerce API is disabled on this site"
    }
  ]
}

Index Properties

Attribute Type Description
name string The name of the site - get_option( 'blogname' )
description string The site’s description - get_option( 'blogdescription' )
URL string The site’s URL - get_option( 'siteurl' )
wc_version string The active WooCommerce version
routes array A list of available endpoints for the site keyed by relative URL. Each endpoint specifies the HTTP methods supported as well as the canonical URL
meta array A list of WooCommerce settings used in the API. See Meta Properties

Meta Properties

Attribute Type Description
currency string Currency ISO Code, e.g. GBP
currency_format string Currency symbol, HTML encoded, e.g. £
currency_position string Currency position, available the following options: right, left, right_space and left_space
decimal_separator string Decimal separator, e.g ,
dimension_unit string The unit set for product dimensions. Valid units are cm, m, cm, mm, in, and yd
generate_password boolean Shows if the API is able to auto generate passwords for new customers
links array API help links list
permalinks_enabled boolean Whether pretty permalinks are enabled on the site, if this is false, the API will not function correctly
price_num_decimals integer Number of decimals
ssl_enabled boolean True if SSL is enabled for the site, false otherwise
tax_included boolean True if prices include tax, false otherwise
thousand_separator string Thousands separator, e.g .
timezone string The site’s timezone
weight_unit string The unit set for product weights. Valid units are kg, g, lbs, oz

View Index List

Retrieve a set of store information.

HTTP Request

GET
/wc-api/v2
curl https://example.com/wc-api/v2 \
    -u consumer_key:consumer_secret
WooCommerce.get('', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("").json())
<?php print_r($woocommerce->index->get()); ?>
woocommerce.get("").parsed_response

JSON response example:

{
    "store": {
        "URL": "http://example.com",
        "description": "",
        "meta": {
            "currency": "USD",
            "currency_format": "&#36;",
            "currency_position": "left_space",
            "decimal_separator": ",",
            "dimension_unit": "in",
            "generate_password": false,
            "links": {
                "help": "http://woocommerce.github.io/woocommerce-rest-api-docs/"
            },
            "permalinks_enabled": true,
            "price_num_decimals": 2,
            "ssl_enabled": true,
            "tax_included": false,
            "thousand_separator": ".",
            "timezone": "America/Sao_Paulo",
            "weight_unit": "lbs"
        },
        "name": "WooCommerce Dev",
        "routes": {
            "/": {
                "meta": {
                    "self": "http://example.com/wc-api/v2/"
                },
                "supports": [
                    "HEAD",
                    "GET"
                ]
            },
            "/coupons": {
                "accepts_data": true,
                "meta": {
                    "self": "http://example.com/wc-api/v2/coupons"
                },
                "supports": [
                    "HEAD",
                    "GET",
                    "POST"
                ]
            },
            "/coupons/<id>": {
                "accepts_data": true,
                "supports": [
                    "HEAD",
                    "GET",
                    "POST",
                    "PUT",
                    "PATCH",
                    "DELETE"
                ]
            },
            "/coupons/bulk": {
                "accepts_data": true,
                "meta": {
                    "self": "http://example.com/wc-api/v2/coupons/bulk"
                },
                "supports": [
                    "POST",
                    "PUT",
                    "PATCH"
                ]
            },
            "/coupons/code/<code>": {
                "supports": [
                    "HEAD",
                    "GET"
                ]
            },
            "/coupons/count": {
                "meta": {
                    "self": "http://example.com/wc-api/v2/coupons/count"
                },
                "supports": [
                    "HEAD",
                    "GET"
                ]
            },
            "/customers": {
                "accepts_data": true,
                "meta": {
                    "self": "http://example.com/wc-api/v2/customers"
                },
                "supports": [
                    "HEAD",
                    "GET",
                    "POST"
                ]
            },
            "/customers/<id>": {
                "accepts_data": true,
                "supports": [
                    "HEAD",
                    "GET",
                    "POST",
                    "PUT",
                    "PATCH",
                    "DELETE"
                ]
            },
            "/customers/<id>/downloads": {
                "supports": [
                    "HEAD",
                    "GET"
                ]
            },
            "/customers/<id>/orders": {
                "supports": [
                    "HEAD",
                    "GET"
                ]
            },
            "/customers/bulk": {
                "accepts_data": true,
                "meta": {
                    "self": "http://example.com/wc-api/v2/customers/bulk"
                },
                "supports": [
                    "POST",
                    "PUT",
                    "PATCH"
                ]
            },
            "/customers/count": {
                "meta": {
                    "self": "http://example.com/wc-api/v2/customers/count"
                },
                "supports": [
                    "HEAD",
                    "GET"
                ]
            },
            "/customers/email/<email>": {
                "supports": [
                    "HEAD",
                    "GET"
                ]
            },
            "/orders": {
                "accepts_data": true,
                "meta": {
                    "self": "http://example.com/wc-api/v2/orders"
                },
                "supports": [
                    "HEAD",
                    "GET",
                    "POST"
                ]
            },
            "/orders/<id>": {
                "accepts_data": true,
                "supports": [
                    "HEAD",
                    "GET",
                    "POST",
                    "PUT",
                    "PATCH",
                    "DELETE"
                ]
            },
            "/orders/<order_id>/notes": {
                "accepts_data": true,
                "supports": [
                    "HEAD",
                    "GET",
                    "POST"
                ]
            },
            "/orders/<order_id>/notes/<id>": {
                "accepts_data": true,
                "supports": [
                    "HEAD",
                    "GET",
                    "POST",
                    "PUT",
                    "PATCH",
                    "DELETE"
                ]
            },
            "/orders/<order_id>/refunds": {
                "accepts_data": true,
                "supports": [
                    "HEAD",
                    "GET",
                    "POST"
                ]
            },
            "/orders/<order_id>/refunds/<id>": {
                "accepts_data": true,
                "supports": [
                    "HEAD",
                    "GET",
                    "POST",
                    "PUT",
                    "PATCH",
                    "DELETE"
                ]
            },
            "/orders/bulk": {
                "accepts_data": true,
                "meta": {
                    "self": "http://example.com/wc-api/v2/orders/bulk"
                },
                "supports": [
                    "POST",
                    "PUT",
                    "PATCH"
                ]
            },
            "/orders/count": {
                "meta": {
                    "self": "http://example.com/wc-api/v2/orders/count"
                },
                "supports": [
                    "HEAD",
                    "GET"
                ]
            },
            "/orders/statuses": {
                "meta": {
                    "self": "http://example.com/wc-api/v2/orders/statuses"
                },
                "supports": [
                    "HEAD",
                    "GET"
                ]
            },
            "/products": {
                "accepts_data": true,
                "meta": {
                    "self": "http://example.com/wc-api/v2/products"
                },
                "supports": [
                    "HEAD",
                    "GET",
                    "POST"
                ]
            },
            "/products/<id>": {
                "accepts_data": true,
                "supports": [
                    "HEAD",
                    "GET",
                    "POST",
                    "PUT",
                    "PATCH",
                    "DELETE"
                ]
            },
            "/products/<id>/orders": {
                "supports": [
                    "HEAD",
                    "GET"
                ]
            },
            "/products/<id>/reviews": {
                "supports": [
                    "HEAD",
                    "GET"
                ]
            },
            "/products/attributes": {
                "accepts_data": true,
                "meta": {
                    "self": "http://example.com/wc-api/v2/products/attributes"
                },
                "supports": [
                    "HEAD",
                    "GET",
                    "POST"
                ]
            },
            "/products/attributes/<id>": {
                "accepts_data": true,
                "supports": [
                    "HEAD",
                    "GET",
                    "POST",
                    "PUT",
                    "PATCH",
                    "DELETE"
                ]
            },
            "/products/bulk": {
                "accepts_data": true,
                "meta": {
                    "self": "http://example.com/wc-api/v2/products/bulk"
                },
                "supports": [
                    "POST",
                    "PUT",
                    "PATCH"
                ]
            },
            "/products/categories": {
                "meta": {
                    "self": "http://example.com/wc-api/v2/products/categories"
                },
                "supports": [
                    "HEAD",
                    "GET"
                ]
            },
            "/products/categories/<id>": {
                "supports": [
                    "HEAD",
                    "GET"
                ]
            },
            "/products/count": {
                "meta": {
                    "self": "http://example.com/wc-api/v2/products/count"
                },
                "supports": [
                    "HEAD",
                    "GET"
                ]
            },
            "/products/sku/<sku>": {
                "supports": [
                    "HEAD",
                    "GET"
                ]
            },
            "/reports": {
                "meta": {
                    "self": "http://example.com/wc-api/v2/reports"
                },
                "supports": [
                    "HEAD",
                    "GET"
                ]
            },
            "/reports/sales": {
                "meta": {
                    "self": "http://example.com/wc-api/v2/reports/sales"
                },
                "supports": [
                    "HEAD",
                    "GET"
                ]
            },
            "/reports/sales/top_sellers": {
                "meta": {
                    "self": "http://example.com/wc-api/v2/reports/sales/top_sellers"
                },
                "supports": [
                    "HEAD",
                    "GET"
                ]
            },
            "/webhooks": {
                "accepts_data": true,
                "meta": {
                    "self": "http://example.com/wc-api/v2/webhooks"
                },
                "supports": [
                    "HEAD",
                    "GET",
                    "POST"
                ]
            },
            "/webhooks/<id>": {
                "accepts_data": true,
                "supports": [
                    "HEAD",
                    "GET",
                    "POST",
                    "PUT",
                    "PATCH",
                    "DELETE"
                ]
            },
            "/webhooks/<webhook_id>/deliveries": {
                "supports": [
                    "HEAD",
                    "GET"
                ]
            },
            "/webhooks/<webhook_id>/deliveries/<id>": {
                "supports": [
                    "HEAD",
                    "GET"
                ]
            },
            "/webhooks/count": {
                "meta": {
                    "self": "http://example.com/wc-api/v2/webhooks/count"
                },
                "supports": [
                    "HEAD",
                    "GET"
                ]
            }
        },
        "wc_version": "2.3.13"
    }
}

Coupons

This section lists all API that can be used to create, edit or otherwise manipulate coupons.

Coupon Properties

Attribute Type Description
id integer Coupon ID (post ID) read-only
code string Coupon code, always lowercase mandatory
type string Coupon type, valid core types are: fixed_cart, percent, fixed_product and percent_product. Default is fixed_cart
created_at string UTC DateTime when the coupon was created read-only
updated_at string UTC DateTime when the coupon was last updated read-only
amount string The amount of discount
individual_use boolean Whether coupon can only be used individually
product_ids array Array of product ID’s the coupon can be used on
exclude_product_ids array Array of product ID’s the coupon cannot be used on
usage_limit integer How many times the coupon can be used
usage_limit_per_user integer How many times the coupon can be user per customer
limit_usage_to_x_items integer Max number of items in the cart the coupon can be applied to
usage_count integer Number of times the coupon has been used already read-only
expiry_date string UTC DateTime`when the coupon expires
enable_free_shipping boolean Is the coupon for free shipping
product_category_ids array Array of category ID’s the coupon applies to
exclude_product_category_ids array Array of category ID’s the coupon does not apply to
exclude_sale_items boolean Exclude sale items from the coupon
minimum_amount string Minimum order amount that needs to be in the cart before coupon applies
maximum_amount string Maximum order amount allowed when using the coupon
customer_emails array Array of email addresses that can use this coupon
description string Coupon description

Create A Coupon

This API helps you to create a new coupon.

HTTP Request

POST
/wc-api/v2/coupons
curl -X POST https://example.com/wc-api/v2/coupons \
    -u consumer_key:consumer_secret \
    -H "Content-Type: application/json" \
    -d '{
  "coupon": {
    "code": "new-coupon",
    "type": "percent",
    "amount": "10",
    "individual_use": true,
    "product_ids": [],
    "exclude_product_ids": [],
    "usage_limit": "",
    "usage_limit_per_user": "",
    "limit_usage_to_x_items": "",
    "expiry_date": "",
    "enable_free_shipping": false,
    "product_category_ids": [],
    "exclude_product_category_ids": [],
    "exclude_sale_items": true,
    "minimum_amount": "100.00",
    "maximum_amount": "0.00",
    "customer_emails": [],
    "description": ""
  }
}'
var data = {
  coupon: {
    code: 'new-coupon',
    type: 'percent',
    amount: '10',
    individual_use: true,
    product_ids: [],
    exclude_product_ids: [],
    usage_limit: '',
    usage_limit_per_user: '',
    limit_usage_to_x_items: '',
    expiry_date: '',
    enable_free_shipping: false,
    product_category_ids: [],
    exclude_product_category_ids: [],
    exclude_sale_items: true,
    minimum_amount: '100.00',
    maximum_amount: '0.00',
    customer_emails: [],
    description: ''
  }
};

WooCommerce.post('coupons', data, function(err, data, res) {
  console.log(res);
});
data = {
    "coupon": {
        "code": "new-coupon",
        "type": "percent",
        "amount": "10",
        "individual_use": True,
        "product_ids": [],
        "exclude_product_ids": [],
        "usage_limit": "",
        "usage_limit_per_user": "",
        "limit_usage_to_x_items": "",
        "expiry_date": "",
        "enable_free_shipping": False,
        "product_category_ids": [],
        "exclude_product_category_ids": [],
        "exclude_sale_items": True,
        "minimum_amount": "100.00",
        "maximum_amount": "0.00",
        "customer_emails": [],
        "description": ""
    }
}

print(wcapi.post("coupons", data).json())
<?php
$data = array(
    'coupon' => array(
        'code' => 'new-coupon',
        'type' => 'percent',
        'amount' => '10',
        'individual_use' => true,
        'product_ids' => array(),
        'exclude_product_ids' => array(),
        'usage_limit' => '',
        'usage_limit_per_user' => '',
        'limit_usage_to_x_items' => '',
        'expiry_date' => '',
        'enable_free_shipping' => false,
        'product_category_ids' => array(),
        'exclude_product_category_ids' => array(),
        'exclude_sale_items' => true,
        'minimum_amount' => '100.00',
        'maximum_amount' => '0.00',
        'customer_emails' => array(),
        'description' => ''
    )
);

print_r($woocommerce->coupons->create($data));
?>
data = {
  coupon: {
    code: "new-coupon",
    type: "percent",
    amount: "10",
    individual_use: true,
    product_ids: [],
    exclude_product_ids: [],
    usage_limit: "",
    usage_limit_per_user: "",
    limit_usage_to_x_items: "",
    expiry_date: "",
    enable_free_shipping: false,
    product_category_ids: [],
    exclude_product_category_ids: [],
    exclude_sale_items: true,
    minimum_amount: "100.00",
    maximum_amount: "0.00",
    customer_emails: [],
    description: ""
  }
}

woocommerce.post("coupons", data).parsed_response

JSON response example:

{
  "coupon": {
    "id": 529,
    "code": "new-coupon",
    "type": "percent",
    "created_at": "2015-01-20T19:05:27Z",
    "updated_at": "2015-01-20T19:05:27Z",
    "amount": "10.00",
    "individual_use": true,
    "product_ids": [],
    "exclude_product_ids": [],
    "usage_limit": null,
    "usage_limit_per_user": null,
    "limit_usage_to_x_items": 0,
    "usage_count": 0,
    "expiry_date": null,
    "enable_free_shipping": false,
    "product_category_ids": [],
    "exclude_product_category_ids": [],
    "exclude_sale_items": true,
    "minimum_amount": "100.00",
    "maximum_amount": "0.00",
    "customer_emails": [],
    "description": ""
  }
}

View A Coupon

This API lets you retrieve and view a specific coupon by ID or code.

HTTP Request

GET
/wc-api/v2/coupons/<id>
GET
/wc-api/v2/coupons/code/<code>
curl https://example.com/wc-api/v2/coupons/529 \
    -u consumer_key:consumer_secret
WooCommerce.get('coupons/529', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("coupons/529").json())
<?php print_r($woocommerce->coupons->get(529)); ?>
woocommerce.get("coupons/529").parsed_response

JSON response example:

{
  "coupon": {
    "id": 529,
    "code": "new-coupon",
    "type": "percent",
    "created_at": "2015-01-20T19:05:27Z",
    "updated_at": "2015-01-20T19:05:27Z",
    "amount": "10.00",
    "individual_use": true,
    "product_ids": [],
    "exclude_product_ids": [],
    "usage_limit": null,
    "usage_limit_per_user": null,
    "limit_usage_to_x_items": 0,
    "usage_count": 0,
    "expiry_date": null,
    "enable_free_shipping": false,
    "product_category_ids": [],
    "exclude_product_category_ids": [],
    "exclude_sale_items": true,
    "minimum_amount": "100.00",
    "maximum_amount": "0.00",
    "customer_emails": [],
    "description": ""
  }
}

View List Of Coupons

This API helps you to view all the coupons.

HTTP Request

GET
/wc-api/v2/coupons
curl https://example.com/wc-api/v2/coupons \
    -u consumer_key:consumer_secret
WooCommerce.get('coupons', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("coupons").json())
<?php print_r($woocommerce->coupons->get()); ?>
woocommerce.get("coupons").parsed_response

JSON response example:

{
  "coupons": [
    {
      "id": 529,
      "code": "new-coupon",
      "type": "percent",
      "created_at": "2015-01-20T19:05:27Z",
      "updated_at": "2015-01-20T19:05:27Z",
      "amount": "10.00",
      "individual_use": true,
      "product_ids": [],
      "exclude_product_ids": [],
      "usage_limit": null,
      "usage_limit_per_user": null,
      "limit_usage_to_x_items": 0,
      "usage_count": 0,
      "expiry_date": null,
      "enable_free_shipping": false,
      "product_category_ids": [],
      "exclude_product_category_ids": [],
      "exclude_sale_items": true,
      "minimum_amount": "100.00",
      "maximum_amount": "0.00",
      "customer_emails": [],
      "description": ""
    },
    {
      "id": 527,
      "code": "free-shipping",
      "type": "fixed_cart",
      "created_at": "2015-01-20T18:35:59Z",
      "updated_at": "2015-01-20T18:35:59Z",
      "amount": "0.00",
      "individual_use": true,
      "product_ids": [],
      "exclude_product_ids": [],
      "usage_limit": null,
      "usage_limit_per_user": null,
      "limit_usage_to_x_items": 0,
      "usage_count": 0,
      "expiry_date": null,
      "enable_free_shipping": true,
      "product_category_ids": [],
      "exclude_product_category_ids": [],
      "exclude_sale_items": true,
      "minimum_amount": "50.00",
      "maximum_amount": "0.00",
      "customer_emails": [],
      "description": ""
    },
    {
      "id": 526,
      "code": "christmas-promo",
      "type": "percent",
      "created_at": "2015-01-20T18:10:58Z",
      "updated_at": "2015-01-20T18:10:58Z",
      "amount": "10.00",
      "individual_use": true,
      "product_ids": [],
      "exclude_product_ids": [],
      "usage_limit": null,
      "usage_limit_per_user": 1,
      "limit_usage_to_x_items": 0,
      "usage_count": 0,
      "expiry_date": "2014-12-25T00:00:00Z",
      "enable_free_shipping": false,
      "product_category_ids": [],
      "exclude_product_category_ids": [],
      "exclude_sale_items": true,
      "minimum_amount": "200.00",
      "maximum_amount": "0.00",
      "customer_emails": [],
      "description": "Discount for Christmas for orders over $ 200"
    }
  ]
}

Update A Coupon

This API lets you make changes to a coupon.

HTTP Request

PUT
/wc-api/v2/coupons/<id>
curl -X PUT https://example.com/wc-api/v2/coupons/529 \
    -u consumer_key:consumer_secret \
    -H "Content-Type: application/json" \
    -d '{
  "coupon": {
    "amount": "5"
  }
}'
var data = {
  coupon: {
    amount: '5'
  }
};

WooCommerce.put('coupons/529', data, function(err, data, res) {
  console.log(res);
});
data = {
    "coupon": {
        "amount": "5"
    }
}

print(wcapi.put("coupons/529", data).json())
<?php
$data = array(
    'coupon' => array(
        'amount' => '5'
    )
);

print_r($woocommerce->coupons->update(529, $data));
?>
data {
  coupon: {
    amount: "5"
  }
}

woocommerce.put("coupons/529", data).parsed_response

JSON response example:

{
  "coupon": {
    "id": 529,
    "code": "new-coupon",
    "type": "percent",
    "created_at": "2015-01-20T19:05:27Z",
    "updated_at": "2015-01-20T19:10:33Z",
    "amount": "5.00",
    "individual_use": true,
    "product_ids": [],
    "exclude_product_ids": [],
    "usage_limit": null,
    "usage_limit_per_user": null,
    "limit_usage_to_x_items": 0,
    "usage_count": 0,
    "expiry_date": null,
    "enable_free_shipping": false,
    "product_category_ids": [],
    "exclude_product_category_ids": [],
    "exclude_sale_items": true,
    "minimum_amount": "100.00",
    "maximum_amount": "0.00",
    "customer_emails": [],
    "description": ""
  }
}

Delete A Coupon

This API helps you delete a coupon.

HTTP Request

DELETE
/wc-api/v2/coupons/<id>
curl -X DELETE https://example.com/wc-api/v2/coupons/529/?force=true \
    -u consumer_key:consumer_secret
WooCommerce.delete('coupons/529/?force=true', function(err, data, res) {
  console.log(res);
});
print(wcapi.delete("coupons/529?force=true").json())
<?php print_r($woocommerce->coupons->delete(529, true)); ?>
woocommerce.delete("coupons/529?force=true").parsed_response

JSON response example:

{
  "message": "Permanently deleted coupon"
}

Parameters

Parameter Type Description
force string Use true whether to permanently delete the coupon, defaults to false. Note that permanently deleting the coupon will return HTTP 200 rather than HTTP 202.

View Coupons Count

This API lets you retrieve a count of all coupons.

HTTP Request

GET
/wc-api/v2/coupons/count
curl https://example.com/wc-api/v2/coupons/count \
    -u consumer_key:consumer_secret
WooCommerce.get('coupons/count', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("coupons/count").json())
<?php print_r($woocommerce->coupons->get_count()); ?>
woocommerce.get("coupons/count").parsed_response

JSON response example:

{
  "count": 3
}

Customers

This section lists all API that can be used to create, edit or otherwise manipulate customers.

Customers Properties

Attribute Type Description
id integer Customer ID (user ID) read-only
created_at string UTC DateTime when the customer was created read-only
email string Customer email address mandatory
first_name string Customer first name
last_name string Customer last name
username string Customer username, can be generated automatically from the customer’s email addrees if the option woocommerce_registration_generate_username is equal to yes cannot be changed
password string Customer password, can be generated automatically with wp_generate_password() if the “Automatically generate customer password” option is enabled, check the index meta for generate_password write-only
last_order_id integer Last order ID read-only
last_order_date string UTC DateTime of the customer last order read-only
orders_count integer Quantity of orders that the customer have read-only
total_spent integer Total amount spent read-only
avatar_url string Gravatar URL
billing_address array List of Billing Address fields. See Billing Address Properties
shipping_address array List of Shipping Address fields. See Shipping Address Properties

Billing Address Properties

Attribute Type Description
first_name string First name
last_name string Last name
company string Company name
address_1 string Address line 1
address_2 string Address line 2
city string City name
state string ISO code or name of the state, province or district
postcode string Postal code
country string ISO code of the country
email string Email address
phone string Phone

Shipping Address Properties

Attribute Type Description
first_name string First name
last_name string Last name
company string Company name
address_1 string Address line 1
address_2 string Address line 2
city string City name
state string ISO code or name of the state, province or district
postcode string Postal code
country string ISO code of the country

Create A Customer

This API helps you to create a new customer.

HTTP Request

POST
/wc-api/v2/customers
curl -X POST https://example.com/wc-api/v2/customers \
    -u consumer_key:consumer_secret \
    -H "Content-Type: application/json" \
    -d '{
  "customer": {
    "email": "john.doe@example.com",
    "first_name": "John",
    "last_name": "Doe",
    "username": "john.doe",
    "billing_address": {
      "first_name": "John",
      "last_name": "Doe",
      "company": "",
      "address_1": "969 Market",
      "address_2": "",
      "city": "San Francisco",
      "state": "CA",
      "postcode": "94103",
      "country": "US",
      "email": "john.doe@example.com",
      "phone": "(555) 555-5555"
    },
    "shipping_address": {
      "first_name": "John",
      "last_name": "Doe",
      "company": "",
      "address_1": "969 Market",
      "address_2": "",
      "city": "San Francisco",
      "state": "CA",
      "postcode": "94103",
      "country": "US"
    }
  }
}'
var data = {
  customer: {
    email: 'john.doe@example.com',
    first_name: 'John',
    last_name: 'Doe',
    username: 'john.doe',
    billing_address: {
      first_name: 'John',
      last_name: 'Doe',
      company: '',
      address_1: '969 Market',
      address_2: '',
      city: 'San Francisco',
      state: 'CA',
      postcode: '94103',
      country: 'US',
      email: 'john.doe@example.com',
      phone: '(555) 555-5555'
    },
    shipping_address: {
      first_name: 'John',
      last_name: 'Doe',
      company: '',
      address_1: '969 Market',
      address_2: '',
      city: 'San Francisco',
      state: 'CA',
      postcode: '94103',
      country: 'US'
    }
  }
};

WooCommerce.post('customers', data, function(err, data, res) {
  console.log(res);
});
data = {
    "customer": {
        "email": "john.doe@example.com",
        "first_name": "John",
        "last_name": "Doe",
        "username": "john.doe",
        "billing_address": {
            "first_name": "John",
            "last_name": "Doe",
            "company": "",
            "address_1": "969 Market",
            "address_2": "",
            "city": "San Francisco",
            "state": "CA",
            "postcode": "94103",
            "country": "US",
            "email": "john.doe@example.com",
            "phone": "(555) 555-5555"
        },
        "shipping_address": {
            "first_name": "John",
            "last_name": "Doe",
            "company": "",
            "address_1": "969 Market",
            "address_2": "",
            "city": "San Francisco",
            "state": "CA",
            "postcode": "94103",
            "country": "US"
        }
    }
}

print(wcapi.post("customers", data).json())
<?php
$data = array(
    'customer' => array(
        'email' => 'john.doe@example.com',
        'first_name' => 'John',
        'last_name' => 'Doe',
        'username' => 'john.doe',
        'billing_address' => array(
            'first_name' => 'John',
            'last_name' => 'Doe',
            'company' => '',
            'address_1' => '969 Market',
            'address_2' => '',
            'city' => 'San Francisco',
            'state' => 'CA',
            'postcode' => '94103',
            'country' => 'US',
            'email' => 'john.doe@example.com',
            'phone' => '(555) 555-5555'
        ),
        'shipping_address' => array(
            'first_name' => 'John',
            'last_name' => 'Doe',
            'company' => '',
            'address_1' => '969 Market',
            'address_2' => '',
            'city' => 'San Francisco',
            'state' => 'CA',
            'postcode' => '94103',
            'country' => 'US'
        )
    )
);

print_r($woocommerce->customers->create($data));
?>
data = {
  customer: {
    email: "john.doe@example.com",
    first_name: "John",
    last_name: "Doe",
    username: "john.doe",
    billing_address: {
      first_name: "John",
      last_name: "Doe",
      company: "",
      address_1: "969 Market",
      address_2: "",
      city: "San Francisco",
      state: "CA",
      postcode: "94103",
      country: "US",
      email: "john.doe@example.com",
      phone: "(555) 555-5555"
    },
    shipping_address: {
      first_name: "John",
      last_name: "Doe",
      company: "",
      address_1: "969 Market",
      address_2: "",
      city: "San Francisco",
      state: "CA",
      postcode: "94103",
      country: "US"
    }
  }
}

woocommerce.post("customers", data).parsed_response

JSON response example:

{
  "customer": {
    "id": 2,
    "created_at": "2015-01-05T18:34:19Z",
    "email": "john.doe@example.com",
    "first_name": "John",
    "last_name": "Doe",
    "username": "john.doe",
    "last_order_id": null,
    "last_order_date": null,
    "orders_count": 0,
    "total_spent": "0.00",
    "avatar_url": "https://secure.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=96",
    "billing_address": {
      "first_name": "John",
      "last_name": "Doe",
      "company": "",
      "address_1": "969 Market",
      "address_2": "",
      "city": "San Francisco",
      "state": "CA",
      "postcode": "94103",
      "country": "US",
      "email": "john.doe@example.com",
      "phone": "(555) 555-5555"
    },
    "shipping_address": {
      "first_name": "John",
      "last_name": "Doe",
      "company": "",
      "address_1": "969 Market",
      "address_2": "",
      "city": "San Francisco",
      "state": "CA",
      "postcode": "94103",
      "country": "US"
    }
  }
}

View A Customer

This API lets you retrieve and view a specific customer by ID or email.

HTTP Request

GET
/wc-api/v2/customers/<id>
GET
/wc-api/v2/customers/email/<email>
curl https://example.com/wc-api/v2/customers/2 \
    -u consumer_key:consumer_secret
WooCommerce.get('customers/2', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("customers/2").json())
<?php print_r($woocommerce->customers->get(2)); ?>
woocommerce.get("customers/2").parsed_response

JSON response example:

{
  "customer": {
    "id": 2,
    "created_at": "2015-01-05T18:34:19Z",
    "email": "john.doe@example.com",
    "first_name": "John",
    "last_name": "Doe",
    "username": "john.doe",
    "last_order_id": null,
    "last_order_date": null,
    "orders_count": 0,
    "total_spent": "0.00",
    "avatar_url": "https://secure.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=96",
    "billing_address": {
      "first_name": "John",
      "last_name": "Doe",
      "company": "",
      "address_1": "969 Market",
      "address_2": "",
      "city": "San Francisco",
      "state": "CA",
      "postcode": "94103",
      "country": "US",
      "email": "john.doe@example.com",
      "phone": "(555) 555-5555"
    },
    "shipping_address": {
      "first_name": "John",
      "last_name": "Doe",
      "company": "",
      "address_1": "969 Market",
      "address_2": "",
      "city": "San Francisco",
      "state": "CA",
      "postcode": "94103",
      "country": "US"
    }
  }
}

View List Of Customers

This API helps you to view all the customers.

HTTP Request

GET
/wc-api/v2/customers
curl https://example.com/wc-api/v2/customers \
    -u consumer_key:consumer_secret
WooCommerce.get('customers', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("customers").json())
<?php print_r($woocommerce->customers->get()); ?>
woocommerce.get("customers").parsed_response

JSON response example:

{
  "customers": [
    {
      "id": 2,
      "created_at": "2015-01-05T18:34:19Z",
      "email": "john.doe@example.com",
      "first_name": "John",
      "last_name": "Doe",
      "username": "john.doe",
      "last_order_id": 123,
      "last_order_date": "2015-01-14T16:47:30Z",
      "orders_count": 10,
      "total_spent": "1034.58",
      "avatar_url": "https://secure.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=96",
      "billing_address": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US",
        "email": "john.doe@example.com",
        "phone": "(555) 555-5555"
      },
      "shipping_address": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US"
      }
    },
    {
      "id": 3,
      "created_at": "2015-01-10T14:25:39Z",
      "email": "joao.silva@example.com",
      "first_name": "João",
      "last_name": "Silva",
      "username": "joao.silva",
      "last_order_id": 120,
      "last_order_date": "2015-01-10T14:26:30Z",
      "orders_count": 1,
      "total_spent": "429.00",
      "avatar_url": "https://secure.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=96",
      "billing_address": {
        "first_name": "João",
        "last_name": "Silva",
        "company": "",
        "address_1": "Av. Brasil, 432",
        "address_2": "",
        "city": "Rio de Janeiro",
        "state": "RJ",
        "postcode": "12345-000",
        "country": "BR",
        "email": "joao.silva@example.com",
        "phone": "(55) 5555-5555"
      },
      "shipping_address": {
        "first_name": "João",
        "last_name": "Silva",
        "company": "",
        "address_1": "Av. Brasil, 432",
        "address_2": "",
        "city": "Rio de Janeiro",
        "state": "RJ",
        "postcode": "12345-000",
        "country": "BR"
      }
    }
  ]
}

Available Filters

Filter Type Description
role string Customers by status. eg: customer or subscriber

Update A Customer

This API lets you make changes to a customer.

HTTP Request

PUT
/wc-api/v2/customers/<id>
curl -X PUT https://example.com/wc-api/v2/customers/2 \
    -u consumer_key:consumer_secret \
    -H "Content-Type: application/json" \
    -d '{
  "customer": {
    "first_name": "James",
    "billing_address": {
      "first_name": "James"
    },
    "shipping_address": {
      "first_name": "James"
    }
  }
}'
var data = {
  customer: {
    first_name: 'James',
    billing_address: {
      first_name: 'James'
    },
    shipping_address: {
      first_name: 'James'
    }
  }
};

WooCommerce.put('customers/2', data, function(err, data, res) {
  console.log(res);
});
data = {
    "customer": {
        "first_name": "James",
        "billing_address": {
            "first_name": "James"
        },
        "shipping_address": {
            "first_name": "James"
        }
    }
}

print(wcapi.put("customers/2", data).json())
<?php
$data = array(
    'customer' => array(
        'first_name' => 'James',
        'billing_address' => array(
            'first_name' => 'James'
        ),
        'shipping_address' => array(
            'first_name' => 'James'
        )
    )
);

print_r($woocommerce->customers->update(2, $data));
?>
data = {
  customer: {
    first_name: "James",
    billing_address: {
      first_name: "James"
    },
    shipping_address: {
      first_name: "James"
    }
  }
}

woocommerce.put("customers/2", data).parsed_response

JSON response example:

{
  "customer": {
    "id": 2,
    "created_at": "2015-01-05T18:34:19Z",
    "email": "john.doe@example.com",
    "first_name": "James",
    "last_name": "Doe",
    "username": "john.doe",
    "last_order_id": null,
    "last_order_date": null,
    "orders_count": 0,
    "total_spent": "0.00",
    "avatar_url": "https://secure.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=96",
    "billing_address": {
      "first_name": "John",
      "last_name": "Doe",
      "company": "",
      "address_1": "969 Market",
      "address_2": "",
      "city": "San Francisco",
      "state": "CA",
      "postcode": "94103",
      "country": "US",
      "email": "john.doe@example.com",
      "phone": "(555) 555-5555"
    },
    "shipping_address": {
      "first_name": "John",
      "last_name": "Doe",
      "company": "",
      "address_1": "969 Market",
      "address_2": "",
      "city": "San Francisco",
      "state": "CA",
      "postcode": "94103",
      "country": "US"
    }
  }
}

Delete A Customer

This API helps you delete a customer.

HTTP Request

DELETE
/wc-api/v2/customers/<id>
curl -X DELETE https://example.com/wc-api/v2/customers/2 \
    -u consumer_key:consumer_secret
WooCommerce.delete('customers/2', function(err, data, res) {
  console.log(res);
});
print(wcapi.delete("customers/2").json())
<?php print_r($woocommerce->customers->delete(2)); ?>
woocommerce.delete("customers/2").parsed_response

JSON response example:

{
  "message": "Permanently deleted customer"
}

View Customer Orders

This API lets you retrieve the customers orders.

HTTP Request

GET
/wc-api/v2/customers/<id>/orders
curl https://example.com/wc-api/v2/customers/2/orders \
    -u consumer_key:consumer_secret
WooCommerce.get('customers/2/orders', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("customers/2/orders").json())
<?php print_r($woocommerce->customers->get_orders(2)); ?>
woocommerce.get("customers/2/orders").parsed_response

JSON response example:

{
  "orders": [
    {
      "id": 531,
      "order_number": 531,
      "created_at": "2015-01-21T12:02:13Z",
      "updated_at": "2015-01-21T12:02:13Z",
      "completed_at": "2015-01-21T12:02:13Z",
      "status": "on-hold",
      "currency": "USD",
      "total": "30.00",
      "subtotal": "20.00",
      "total_line_items_quantity": 1,
      "total_tax": "0.00",
      "total_shipping": "10.00",
      "cart_tax": "0.00",
      "shipping_tax": "0.00",
      "total_discount": "0.00",
      "shipping_methods": "Flat Rate",
      "payment_details": {
        "method_id": "bacs",
        "method_title": "Direct Bank Transfer",
        "paid": false
      },
      "billing_address": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US",
        "email": "john.doe@example.com",
        "phone": "(555) 555-5555"
      },
      "shipping_address": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US"
      },
      "note": "",
      "customer_ip": "127.0.0.1",
      "customer_user_agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0",
      "customer_id": 2,
      "view_order_url": "https://example.com/my-account/view-order/531",
      "line_items": [
        {
          "id": 417,
          "subtotal": "20.00",
          "subtotal_tax": "0.00",
          "total": "20.00",
          "total_tax": "0.00",
          "price": "20.00",
          "quantity": 1,
          "tax_class": null,
          "name": "Premium Quality",
          "product_id": 19,
          "sku": "",
          "meta": []
        }
      ],
      "shipping_lines": [
        {
          "id": 418,
          "method_id": "flat_rate",
          "method_title": "Flat Rate",
          "total": "10.00"
        }
      ],
      "tax_lines": [],
      "fee_lines": [],
      "coupon_lines": [],
      "customer": {
        "id": 2,
        "created_at": "2014-11-19T18:34:19Z",
        "email": "john.doe@example.com",
        "first_name": "",
        "last_name": "",
        "username": "john.doe",
        "last_order_id": "531",
        "last_order_date": "2015-01-21T12:02:13Z",
        "orders_count": 1,
        "total_spent": "0.00",
        "avatar_url": "https://secure.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=96",
        "billing_address": {
          "first_name": "John",
          "last_name": "Doe",
          "company": "",
          "address_1": "969 Market",
          "address_2": "",
          "city": "San Francisco",
          "state": "CA",
          "postcode": "94103",
          "country": "US",
          "email": "john.doe@example.com",
          "phone": "(555) 555-5555"
        },
        "shipping_address": {
          "first_name": "John",
          "last_name": "Doe",
          "company": "",
          "address_1": "969 Market",
          "address_2": "",
          "city": "San Francisco",
          "state": "CA",
          "postcode": "94103",
          "country": "US"
        }
      }
    }
  ]
}

View Customer Downloads

This API lets you retrieve the customers downloads.

HTTP Request

GET
/wc-api/v2/customers/<id>/downloads
curl https://example.com/wc-api/v2/customers/2/downloads \
    -u consumer_key:consumer_secret
WooCommerce.get('customers/2/downloads', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("customers/2/downloads").json())
<?php print_r($woocommerce->customers->get_downloads(2)); ?>
woocommerce.get("customers/2/downloads").parsed_response

JSON response example:

{
  "downloads": [
    {
      "download_url": "https://example.com/?download_file=96&order=wc_order_9999999999999&email=john.doe@example.com&key=99999999999999999999999999999999",
      "download_id": "99999999999999999999999999999999",
      "product_id": 96,
      "download_name": "Woo Album #4 &ndash; Woo Album",
      "order_id": 532,
      "order_key": "wc_order_9999999999999",
      "downloads_remaining": "5",
      "access_expires": null,
      "file": {
        "name": "Woo Album",
        "file": "http://example.com/wp-content/uploads/woocommerce_uploads/2015/01/album.zip"
      }
    }
  ]
}

Customer Downloads Properties

Attribute Type Description
download_url string Download file URL
download_id string Download ID
product_id integer Downloadable product ID
download_name string Downloadable file name
order_id integer Order ID
order_key string Order Key
downloads_remaining string Amount of downloads remaining. An empty string means that is “Unlimited”
access_expires string UTC DateTime when the download access expires. null means “Never”
file array List for downloadable files, each one have a name (file name) and file (file URL) attribute

View Customers Count

This API lets you retrieve a count of all customers.

HTTP Request

GET
/wc-api/v2/customers/count
curl https://example.com/wc-api/v2/customers/count \
    -u consumer_key:consumer_secret
WooCommerce.get('customers/count', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("customers/count").json())
<?php print_r($woocommerce->customers->get_count()); ?>
woocommerce.get("customers/count").parsed_response

JSON response example:

{
  "count": 10
}

Available Filters

Filter Type Description
role string Customers by status. eg: customer or subscriber

Orders

This section lists all API that can be used to create, edit or otherwise manipulate orders.

Orders Properties

Attribute Type Description
id integer Order ID (post ID) read-only
order_number integer Order number read-only
created_at string UTC DateTime when the order was created read-only
updated_at string UTC DateTime when the order was last updated read-only
completed_at string UTC DateTime when the order was last completed read-only
status string Order status. By default are available the status: pending, processing, on-hold, completed, cancelled, refunded and failed. See View List of Order Statuses
currency string Currency in ISO format, e.g USD
total string Order total read-only
subtotal string Order subtotal read-only
total_line_items_quantity integer Total of order items read-only
total_tax string Order tax total read-only
total_shipping string Order shipping total read-only
cart_tax string Order cart tax read-only
shipping_tax string Order shipping tax read-only
total_discount string Order total discount read-only
shipping_methods string Text list of the shipping methods used in the order read-only
payment_details array List of payment details. See Payment Details Properties
billing_address array List of customer billing address. See Customer Billing Address Properties
shipping_address array List of customer shipping address. See Customer Shipping Address Properties
note string Customer order notes
customer_ip string Customer IP address read-only
customer_user_agent string Customer User-Agent read-only
customer_id integer Customer ID (user ID) required
view_order_url string URL to view the order in frontend read-only
line_items array List of order line items. See Line Items Properties
shipping_lines array List of shipping line items. See Shipping Lines Properties
tax_lines array List of tax line items. See Tax Lines Properties read-only
fee_lines array List of fee line items. See Fee Lines Properites
coupon_lines array List of cupon line items. See Coupon Lines Properties
customer array Customer data. See Customer Properties

Payment Details Properties

Attribute Type Description
method_id string Payment method ID required
method_title string Payment method title required
paid boolean Shows/define if the order is paid using this payment method. Use true to complate the payment.
transaction_id string Transaction ID, an optional field to set the transacion ID when complate one payment (to set this you need set the paid as true too)

Line Items Properties

Attribute Type Description
id integer Line item ID read-only
subtotal string Line item subtotal
subtotal_tax string Line item tax subtotal
total string Line item total
total_tax string Line item tax total
price string Product price read-only
quantity integer Quantity
tax_class string Product tax class read-only
name string Product name read-only
product_id integer Product ID required
sku string Product SKU read-only
meta array List of product meta items. See Products Meta Items Properties
variations array List of product variation attributes. e.g: "variation": {"pa_color": "Black", "pa_size": "XGG"} (Use pa_ prefix when is a product attribute) write-only

Products Meta Items Properties

Attribute Type Description
key string Meta item key
label string Meta item label
value string Meta item value

Shipping Lines Properties

Attribute Type Description
id integer Shipping line ID read-only
method_id string Shipping method ID required
method_title string Shipping method title required
total string Total amount

Tax Lines Properties

Attribute Type Description
id integer Tax rate line ID read-only
rate_id integer Tax rate ID read-only
code string Tax rate code read-only
title string Tax rate title/name read-only
total string Tax rate total read-only
compound boolean Shows if is or not a compound rate. Compound tax rates are applied on top of other tax rates. read-only

Fee Lines Properites

Attribute Type Description
id integer Fee line ID read-only
title string Shipping method title required
taxable boolean Shows/define if the fee is taxable write-only
tax_class string Tax class, requered in write-mode if the fee is taxable
total string Total amount
total_tax string Tax total

Coupon Lines Properties

Attribute Type Description
id integer Coupon line ID read-only
code string Coupon code required
amount string Total amount required

Create An Order

This API helps you to create a new order.

HTTP Request

POST
/wc-api/v2/orders

Example of create a paid order:

curl -X POST https://example.com/wc-api/v2/orders \
    -u consumer_key:consumer_secret \
    -H "Content-Type: application/json" \
    -d '{
  "order": {
    "payment_details": {
      "method_id": "bacs",
      "method_title": "Direct Bank Transfer",
      "paid": true
    },
    "billing_address": {
      "first_name": "John",
      "last_name": "Doe",
      "address_1": "969 Market",
      "address_2": "",
      "city": "San Francisco",
      "state": "CA",
      "postcode": "94103",
      "country": "US",
      "email": "john.doe@example.com",
      "phone": "(555) 555-5555"
    },
    "shipping_address": {
      "first_name": "John",
      "last_name": "Doe",
      "address_1": "969 Market",
      "address_2": "",
      "city": "San Francisco",
      "state": "CA",
      "postcode": "94103",
      "country": "US"
    },
    "customer_id": 2,
    "line_items": [
      {
        "product_id": 546,
        "quantity": 2
      },
      {
        "product_id": 613,
        "quantity": 1,
        "variations": {
          "pa_color": "Black"
        }
      }
    ],
    "shipping_lines": [
      {
        "method_id": "flat_rate",
        "method_title": "Flat Rate",
        "total": 10
      }
    ]
  }
}'
var data = {
  order: {
    payment_details: {
      method_id: 'bacs',
      method_title: 'Direct Bank Transfer',
      paid: true
    },
    billing_address: {
      first_name: 'John',
      last_name: 'Doe',
      address_1: '969 Market',
      address_2: '',
      city: 'San Francisco',
      state: 'CA',
      postcode: '94103',
      country: 'US',
      email: 'john.doe@example.com',
      phone: '(555) 555-5555'
    },
    shipping_address: {
      first_name: 'John',
      last_name: 'Doe',
      address_1: '969 Market',
      address_2: '',
      city: 'San Francisco',
      state: 'CA',
      postcode: '94103',
      country: 'US'
    },
    customer_id: 2,
    line_items: [
      {
        product_id: 546,
        quantity: 2
      },
      {
        product_id: 613,
        quantity: 1,
        variations: {
          pa_color: 'Black'
        }
      }
    ],
    shipping_lines: [
      {
        method_id: 'flat_rate',
        method_title: 'Flat Rate',
        total: 10
      }
    ]
  }
};

WooCommerce.post('orders', data, function(err, data, res) {
  console.log(res);
});
data = {
    "order": {
        "payment_details": {
            "method_id": "bacs",
            "method_title": "Direct Bank Transfer",
            "paid": True
        },
        "billing_address": {
            "first_name": "John",
            "last_name": "Doe",
            "address_1": "969 Market",
            "address_2": "",
            "city": "San Francisco",
            "state": "CA",
            "postcode": "94103",
            "country": "US",
            "email": "john.doe@example.com",
            "phone": "(555) 555-5555"
        },
        "shipping_address": {
            "first_name": "John",
            "last_name": "Doe",
            "address_1": "969 Market",
            "address_2": "",
            "city": "San Francisco",
            "state": "CA",
            "postcode": "94103",
            "country": "US"
        },
        "customer_id": 2,
        "line_items": [
            {
                "product_id": 546,
                "quantity": 2
            },
            {
                "product_id": 613,
                "quantity": 1,
                "variations": {
                    "pa_color": "Black"
                }
            }
        ],
        "shipping_lines": [
            {
                "method_id": "flat_rate",
                "method_title": "Flat Rate",
                "total": 10
            }
        ]
    }
}

print(wcapi.post("orders", data).json())
<?php
$data = array(
    'order' => array(
        'payment_details' => array(
            'method_id' => 'bacs',
            'method_title' => 'Direct Bank Transfer',
            'paid' => true
        ),
        'billing_address' => array(
            'first_name' => 'John',
            'last_name' => 'Doe',
            'address_1' => '969 Market',
            'address_2' => '',
            'city' => 'San Francisco',
            'state' => 'CA',
            'postcode' => '94103',
            'country' => 'US',
            'email' => 'john.doe@example.com',
            'phone' => '(555) 555-5555'
        ),
        'shipping_address' => array(
            'first_name' => 'John',
            'last_name' => 'Doe',
            'address_1' => '969 Market',
            'address_2' => '',
            'city' => 'San Francisco',
            'state' => 'CA',
            'postcode' => '94103',
            'country' => 'US'
        ),
        'customer_id' => 2,
        'line_items' => array(
            array(
                'product_id' => 546,
                'quantity' => 2
            ),
            array(
                'product_id' => 613,
                'quantity' => 1,
                'variations' => array(
                    'pa_color' => 'Black'
                )
            )
        ),
        'shipping_lines' => array(
            array(
                'method_id' => 'flat_rate',
                'method_title' => 'Flat Rate',
                'total' => 10
            )
        )
    )
);

print_r($woocommerce->orders->create($data));
?>
data = {
  order: {
    payment_details: {
      method_id: "bacs",
      method_title: "Direct Bank Transfer",
      paid: true
    },
    billing_address: {
      first_name: "John",
      last_name: "Doe",
      address_1: "969 Market",
      address_2: "",
      city: "San Francisco",
      state: "CA",
      postcode: "94103",
      country: "US",
      email: "john.doe@example.com",
      phone: "(555) 555-5555"
    },
    shipping_address: {
      first_name: "John",
      last_name: "Doe",
      address_1: "969 Market",
      address_2: "",
      city: "San Francisco",
      state: "CA",
      postcode: "94103",
      country: "US"
    },
    customer_id: 2,
    line_items: [
        {
          product_id: 546,
          quantity: 2
        },
        {
          product_id: 613,
          quantity: 1,
          variations: {
            pa_color: "Black"
          }
        }
    ],
    shipping_lines: [
        {
          method_id: "flat_rate",
          method_title: "Flat Rate",
          total: 10
        }
    ]
  }
}

woocommerce.post("orders", data).parsed_response

JSON response example:

{
  "order": {
    "id": 645,
    "order_number": 645,
    "created_at": "2015-01-26T20:00:21Z",
    "updated_at": "2015-01-26T20:00:21Z",
    "completed_at": "2015-01-26T20:00:21Z",
    "status": "processing",
    "currency": "USD",
    "total": "79.87",
    "subtotal": "63.97",
    "total_line_items_quantity": 3,
    "total_tax": "5.90",
    "total_shipping": "10.00",
    "cart_tax": "5.40",
    "shipping_tax": "0.50",
    "total_discount": "0.00",
    "shipping_methods": "Flat Rate",
    "payment_details": {
      "method_id": "bacs",
      "method_title": "Direct Bank Transfer",
      "paid": true
    },
    "billing_address": {
      "first_name": "John",
      "last_name": "Doe",
      "company": "",
      "address_1": "969 Market",
      "address_2": "",
      "city": "San Francisco",
      "state": "CA",
      "postcode": "94103",
      "country": "US",
      "email": "john.doe@example.com",
      "phone": "(555) 555-5555"
    },
    "shipping_address": {
      "first_name": "John",
      "last_name": "Doe",
      "company": "",
      "address_1": "969 Market",
      "address_2": "",
      "city": "San Francisco",
      "state": "CA",
      "postcode": "94103",
      "country": "US"
    },
    "note": "",
    "customer_ip": "127.0.0.1",
    "customer_user_agent": "WordPress/4.1; http://example.com",
    "customer_id": 2,
    "view_order_url": "https://example.com/my-account/view-order/645",
    "line_items": [
      {
        "id": 504,
        "subtotal": "43.98",
        "subtotal_tax": "4.40",
        "total": "43.98",
        "total_tax": "4.40",
        "price": "21.99",
        "quantity": 2,
        "tax_class": "reduced-rate",
        "name": "Premium Quality",
        "product_id": 546,
        "sku": "",
        "meta": []
      },
      {
        "id": 505,
        "subtotal": "19.99",
        "subtotal_tax": "1.00",
        "total": "19.99",
        "total_tax": "1.00",
        "price": "19.99",
        "quantity": 1,
        "tax_class": null,
        "name": "Ship Your Idea",
        "product_id": 613,
        "sku": "",
        "meta": [
          {
            "key": "pa_color",
            "label": "Color",
            "value": "Black"
          }
        ]
      }
    ],
    "shipping_lines": [
      {
        "id": 506,
        "method_id": "flat_rate",
        "method_title": "Flat Rate",
        "total": "10.00"
      }
    ],
    "tax_lines": [
      {
        "id": 507,
        "rate_id": "5",
        "code": "US-CA-TAX-1",
        "title": "Tax",
        "total": "4.40",
        "compound": false
      },
      {
        "id": 508,
        "rate_id": "4",
        "code": "US-STANDARD-1",
        "title": "Standard",
        "total": "1.50",
        "compound": false
      }
    ],
    "fee_lines": [],
    "coupon_lines": [],
    "customer": {
      "id": 2,
      "created_at": "2014-11-19T18:34:19Z",
      "email": "john.doe@example.com",
      "first_name": "",
      "last_name": "",
      "username": "john.doe",
      "last_order_id": "645",
      "last_order_date": "2015-01-26T20:00:21Z",
      "orders_count": 2,
      "total_spent": "19.00",
      "avatar_url": "https://secure.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=96",
      "billing_address": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US",
        "email": "john.doe@example.com",
        "phone": "(555) 555-5555"
      },
      "shipping_address": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US"
      }
    }
  }
}

View An Order

This API lets you retrieve and view a specific order.

HTTP Request

GET
/wc-api/v2/orders/<id>
curl https://example.com/wc-api/v2/orders/645 \
    -u consumer_key:consumer_secret
WooCommerce.get('orders/645', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("orders/645").json())
<?php print_r($woocommerce->orders->get(645)); ?>
woocommerce.get("orders/645").parsed_response

JSON response example:

{
  "order": {
    "id": 645,
    "order_number": 645,
    "created_at": "2015-01-26T20:00:21Z",
    "updated_at": "2015-01-26T20:00:21Z",
    "completed_at": "2015-01-26T20:00:21Z",
    "status": "processing",
    "currency": "USD",
    "total": "79.87",
    "subtotal": "63.97",
    "total_line_items_quantity": 3,
    "total_tax": "5.90",
    "total_shipping": "10.00",
    "cart_tax": "5.40",
    "shipping_tax": "0.50",
    "total_discount": "0.00",
    "shipping_methods": "Flat Rate",
    "payment_details": {
      "method_id": "bacs",
      "method_title": "Direct Bank Transfer",
      "paid": true
    },
    "billing_address": {
      "first_name": "John",
      "last_name": "Doe",
      "company": "",
      "address_1": "969 Market",
      "address_2": "",
      "city": "San Francisco",
      "state": "CA",
      "postcode": "94103",
      "country": "US",
      "email": "john.doe@example.com",
      "phone": "(555) 555-5555"
    },
    "shipping_address": {
      "first_name": "John",
      "last_name": "Doe",
      "company": "",
      "address_1": "969 Market",
      "address_2": "",
      "city": "San Francisco",
      "state": "CA",
      "postcode": "94103",
      "country": "US"
    },
    "note": "",
    "customer_ip": "127.0.0.1",
    "customer_user_agent": "WordPress/4.1; http://example.com",
    "customer_id": 2,
    "view_order_url": "https://example.com/my-account/view-order/645",
    "line_items": [
      {
        "id": 504,
        "subtotal": "43.98",
        "subtotal_tax": "4.40",
        "total": "43.98",
        "total_tax": "4.40",
        "price": "21.99",
        "quantity": 2,
        "tax_class": "reduced-rate",
        "name": "Premium Quality",
        "product_id": 546,
        "sku": "",
        "meta": []
      },
      {
        "id": 505,
        "subtotal": "19.99",
        "subtotal_tax": "1.00",
        "total": "19.99",
        "total_tax": "1.00",
        "price": "19.99",
        "quantity": 1,
        "tax_class": null,
        "name": "Ship Your Idea",
        "product_id": 613,
        "sku": "",
        "meta": [
          {
            "key": "pa_color",
            "label": "Color",
            "value": "Black"
          }
        ]
      }
    ],
    "shipping_lines": [
      {
        "id": 506,
        "method_id": "flat_rate",
        "method_title": "Flat Rate",
        "total": "10.00"
      }
    ],
    "tax_lines": [
      {
        "id": 507,
        "rate_id": "5",
        "code": "US-CA-TAX-1",
        "title": "Tax",
        "total": "4.40",
        "compound": false
      },
      {
        "id": 508,
        "rate_id": "4",
        "code": "US-STANDARD-1",
        "title": "Standard",
        "total": "1.50",
        "compound": false
      }
    ],
    "fee_lines": [],
    "coupon_lines": [],
    "customer": {
      "id": 2,
      "created_at": "2014-11-19T18:34:19Z",
      "email": "john.doe@example.com",
      "first_name": "",
      "last_name": "",
      "username": "john.doe",
      "last_order_id": "645",
      "last_order_date": "2015-01-26T20:00:21Z",
      "orders_count": 2,
      "total_spent": "19.00",
      "avatar_url": "https://secure.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=96",
      "billing_address": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US",
        "email": "john.doe@example.com",
        "phone": "(555) 555-5555"
      },
      "shipping_address": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US"
      }
    }
  }
}

View List Of Orders

This API helps you to view all the orders.

HTTP Request

GET
/wc-api/v2/orders
curl https://example.com/wc-api/v2/orders \
    -u consumer_key:consumer_secret
WooCommerce.get('orders', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("orders").json())
<?php print_r($woocommerce->orders->get()); ?>
woocommerce.get("orders").parsed_response

JSON response example:

{
  "orders": [
    {
      "id": 645,
      "order_number": 645,
      "created_at": "2015-01-26T20:00:21Z",
      "updated_at": "2015-01-26T20:00:21Z",
      "completed_at": "2015-01-26T20:00:21Z",
      "status": "processing",
      "currency": "USD",
      "total": "79.87",
      "subtotal": "63.97",
      "total_line_items_quantity": 3,
      "total_tax": "5.90",
      "total_shipping": "10.00",
      "cart_tax": "5.40",
      "shipping_tax": "0.50",
      "total_discount": "0.00",
      "shipping_methods": "Flat Rate",
      "payment_details": {
        "method_id": "bacs",
        "method_title": "Direct Bank Transfer",
        "paid": true
      },
      "billing_address": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US",
        "email": "john.doe@example.com",
        "phone": "(555) 555-5555"
      },
      "shipping_address": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US"
      },
      "note": "",
      "customer_ip": "127.0.0.1",
      "customer_user_agent": "WordPress/4.1; http://example.com",
      "customer_id": 2,
      "view_order_url": "https://example.com/my-account/view-order/645",
      "line_items": [
        {
          "id": 504,
          "subtotal": "43.98",
          "subtotal_tax": "4.40",
          "total": "43.98",
          "total_tax": "4.40",
          "price": "21.99",
          "quantity": 2,
          "tax_class": "reduced-rate",
          "name": "Premium Quality",
          "product_id": 546,
          "sku": "",
          "meta": []
        },
        {
          "id": 505,
          "subtotal": "19.99",
          "subtotal_tax": "1.00",
          "total": "19.99",
          "total_tax": "1.00",
          "price": "19.99",
          "quantity": 1,
          "tax_class": null,
          "name": "Ship Your Idea",
          "product_id": 613,
          "sku": "",
          "meta": [
            {
              "key": "pa_color",
              "label": "Color",
              "value": "Black"
            }
          ]
        }
      ],
      "shipping_lines": [
        {
          "id": 506,
          "method_id": "flat_rate",
          "method_title": "Flat Rate",
          "total": "10.00"
        }
      ],
      "tax_lines": [
        {
          "id": 507,
          "rate_id": "5",
          "code": "US-CA-TAX-1",
          "title": "Tax",
          "total": "4.40",
          "compound": false
        },
        {
          "id": 508,
          "rate_id": "4",
          "code": "US-STANDARD-1",
          "title": "Standard",
          "total": "1.50",
          "compound": false
        }
      ],
      "fee_lines": [],
      "coupon_lines": [],
      "customer": {
        "id": 2,
        "created_at": "2014-11-19T18:34:19Z",
        "email": "john.doe@example.com",
        "first_name": "",
        "last_name": "",
        "username": "john.doe",
        "last_order_id": "645",
        "last_order_date": "2015-01-26T20:00:21Z",
        "orders_count": 2,
        "total_spent": "19.00",
        "avatar_url": "https://secure.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=96",
        "billing_address": {
          "first_name": "John",
          "last_name": "Doe",
          "company": "",
          "address_1": "969 Market",
          "address_2": "",
          "city": "San Francisco",
          "state": "CA",
          "postcode": "94103",
          "country": "US",
          "email": "john.doe@example.com",
          "phone": "(555) 555-5555"
        },
        "shipping_address": {
          "first_name": "John",
          "last_name": "Doe",
          "company": "",
          "address_1": "969 Market",
          "address_2": "",
          "city": "San Francisco",
          "state": "CA",
          "postcode": "94103",
          "country": "US"
        }
      }
    },
    {
      "id": 644,
      "order_number": 644,
      "created_at": "2015-01-26T19:33:42Z",
      "updated_at": "2015-01-26T19:33:42Z",
      "completed_at": "2015-01-26T19:33:42Z",
      "status": "on-hold",
      "currency": "USD",
      "total": "44.14",
      "subtotal": "30.99",
      "total_line_items_quantity": 2,
      "total_tax": "3.15",
      "total_shipping": "10.00",
      "cart_tax": "2.65",
      "shipping_tax": "0.50",
      "total_discount": "0.00",
      "shipping_methods": "Flat Rate",
      "payment_details": {
        "method_id": "bacs",
        "method_title": "Direct Bank Transfer",
        "paid": false
      },
      "billing_address": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US",
        "email": "john.doe@example.com",
        "phone": "(555) 555-5555"
      },
      "shipping_address": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US"
      },
      "note": "",
      "customer_ip": "127.0.0.1",
      "customer_user_agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.91 Safari/537.36",
      "customer_id": 2,
      "view_order_url": "https://example.com/my-account/view-order/644",
      "line_items": [
        {
          "id": 499,
          "subtotal": "21.99",
          "subtotal_tax": "2.20",
          "total": "21.99",
          "total_tax": "2.20",
          "price": "21.99",
          "quantity": 1,
          "tax_class": "reduced-rate",
          "name": "Premium Quality",
          "product_id": 546,
          "sku": "",
          "meta": []
        },
        {
          "id": 500,
          "subtotal": "9.00",
          "subtotal_tax": "0.45",
          "total": "9.00",
          "total_tax": "0.45",
          "price": "9.00",
          "quantity": 1,
          "tax_class": null,
          "name": "Woo Album #4",
          "product_id": 96,
          "sku": "",
          "meta": []
        }
      ],
      "shipping_lines": [
        {
          "id": 501,
          "method_id": "flat_rate",
          "method_title": "Flat Rate",
          "total": "10.00"
        }
      ],
      "tax_lines": [
        {
          "id": 502,
          "rate_id": "5",
          "code": "US-CA-TAX-1",
          "title": "Tax",
          "total": "4.40",
          "compound": false
        },
        {
          "id": 503,
          "rate_id": "4",
          "code": "US-STANDARD-1",
          "title": "Standard",
          "total": "1.50",
          "compound": false
        }
      ],
      "fee_lines": [],
      "coupon_lines": [],
      "customer": {
        "id": 2,
        "created_at": "2014-11-19T18:34:19Z",
        "email": "john.doe@example.com",
        "first_name": "",
        "last_name": "",
        "username": "john.doe",
        "last_order_id": "645",
        "last_order_date": "2015-01-26T20:00:21Z",
        "orders_count": 2,
        "total_spent": "19.00",
        "avatar_url": "https://secure.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=96",
        "billing_address": {
          "first_name": "John",
          "last_name": "Doe",
          "company": "",
          "address_1": "969 Market",
          "address_2": "",
          "city": "San Francisco",
          "state": "CA",
          "postcode": "94103",
          "country": "US",
          "email": "john.doe@example.com",
          "phone": "(555) 555-5555"
        },
        "shipping_address": {
          "first_name": "John",
          "last_name": "Doe",
          "company": "",
          "address_1": "969 Market",
          "address_2": "",
          "city": "San Francisco",
          "state": "CA",
          "postcode": "94103",
          "country": "US"
        }
      }
    }
  ]
}

Available Filters

Filter Type Description
status string Orders by status. eg: processing or cancelled

Update An Order

This API lets you make changes to an order.

HTTP Request

PUT
/wc-api/v2/orders/<id>
curl -X PUT https://example.com/wc-api/v2/orders/645 \
    -u consumer_key:consumer_secret \
    -H "Content-Type: application/json" \
    -d '{
  "order": {
    "status": "completed"
  }
}'
var data = {
  order: {
    status: 'completed'
  }
};

WooCommerce.put('orders/645', data, function(err, data, res) {
  console.log(res);
});
data = {
    "order": {
        "status": "completed"
    }
}

print(wcapi.put("orders/645", data).json())
<?php
$data = array(
    'order' => array(
        'status' => 'completed'
    )
);

print_r($woocommerce->orders->update(645, $data));
?>
data = {
  order: {
    status: "completed"
  }
}

woocommerce.put("orders/645", data).parsed_response

JSON response example:

{
  "order": {
    "id": 645,
    "order_number": 645,
    "created_at": "2015-01-26T20:00:21Z",
    "updated_at": "2015-01-26T20:00:21Z",
    "completed_at": "2015-01-26T20:00:21Z",
    "status": "completed",
    "currency": "USD",
    "total": "79.87",
    "subtotal": "63.97",
    "total_line_items_quantity": 3,
    "total_tax": "5.90",
    "total_shipping": "10.00",
    "cart_tax": "5.40",
    "shipping_tax": "0.50",
    "total_discount": "0.00",
    "shipping_methods": "Flat Rate",
    "payment_details": {
      "method_id": "bacs",
      "method_title": "Direct Bank Transfer",
      "paid": true
    },
    "billing_address": {
      "first_name": "John",
      "last_name": "Doe",
      "company": "",
      "address_1": "969 Market",
      "address_2": "",
      "city": "San Francisco",
      "state": "CA",
      "postcode": "94103",
      "country": "US",
      "email": "john.doe@example.com",
      "phone": "(555) 555-5555"
    },
    "shipping_address": {
      "first_name": "John",
      "last_name": "Doe",
      "company": "",
      "address_1": "969 Market",
      "address_2": "",
      "city": "San Francisco",
      "state": "CA",
      "postcode": "94103",
      "country": "US"
    },
    "note": "",
    "customer_ip": "127.0.0.1",
    "customer_user_agent": "WordPress/4.1; http://example.com",
    "customer_id": 2,
    "view_order_url": "https://example.com/my-account/view-order/645",
    "line_items": [
      {
        "id": 504,
        "subtotal": "43.98",
        "subtotal_tax": "4.40",
        "total": "43.98",
        "total_tax": "4.40",
        "price": "21.99",
        "quantity": 2,
        "tax_class": "reduced-rate",
        "name": "Premium Quality",
        "product_id": 546,
        "sku": "",
        "meta": []
      },
      {
        "id": 505,
        "subtotal": "19.99",
        "subtotal_tax": "1.00",
        "total": "19.99",
        "total_tax": "1.00",
        "price": "19.99",
        "quantity": 1,
        "tax_class": null,
        "name": "Ship Your Idea",
        "product_id": 613,
        "sku": "",
        "meta": [
          {
            "key": "pa_color",
            "label": "Color",
            "value": "Black"
          }
        ]
      }
    ],
    "shipping_lines": [
      {
        "id": 506,
        "method_id": "flat_rate",
        "method_title": "Flat Rate",
        "total": "10.00"
      }
    ],
    "tax_lines": [
      {
        "id": 507,
        "rate_id": "5",
        "code": "US-CA-TAX-1",
        "title": "Tax",
        "total": "4.40",
        "compound": false
      },
      {
        "id": 508,
        "rate_id": "4",
        "code": "US-STANDARD-1",
        "title": "Standard",
        "total": "1.50",
        "compound": false
      }
    ],
    "fee_lines": [],
    "coupon_lines": [],
    "customer": {
      "id": 2,
      "created_at": "2014-11-19T18:34:19Z",
      "email": "john.doe@example.com",
      "first_name": "",
      "last_name": "",
      "username": "john.doe",
      "last_order_id": "645",
      "last_order_date": "2015-01-26T20:00:21Z",
      "orders_count": 2,
      "total_spent": "19.00",
      "avatar_url": "https://secure.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=96",
      "billing_address": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US",
        "email": "john.doe@example.com",
        "phone": "(555) 555-5555"
      },
      "shipping_address": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US"
      }
    }
  }
}

Delete An Order

This API helps you delete an order.

HTTP Request

DELETE
/wc-api/v2/orders/<id>
curl -X DELETE https://example.com/wc-api/v2/orders/645/?force=true \
    -u consumer_key:consumer_secret
WooCommerce.delete('orders/645/?force=true', function(err, data, res) {
  console.log(res);
});
print(wcapi.delete("orders/645/?force=true").json())
<?php print_r($woocommerce->orders->delete(645, true)); ?>
woocommerce.delete("orders/645/?force=true").parsed_response

JSON response example:

{
  "message": "Permanently deleted order"
}

Parameters

Parameter Type Description
force string Use true whether to permanently delete the order, defaults to false. Note that permanently deleting the order will return HTTP 200 rather than HTTP 202.

View Orders Count

This API lets you retrieve a count of all orders.

HTTP Request

GET
/wc-api/v2/orders/count
curl https://example.com/wc-api/v2/orders/count \
    -u consumer_key:consumer_secret
WooCommerce.get('orders/count', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("orders/count").json())
<?php print_r($woocommerce->orders->get_count()); ?>
woocommerce.get("orders/count").parsed_response

JSON response example:

{
  "count": 2
}

Available Filters

Filter Type Description
status string Orders by status. eg: processing or cancelled

View List Of Order Statuses

This API lets you retrieve a list of orders statuses available.

HTTP Request

GET
/wc-api/v2/orders/statuses
curl https://example.com/wc-api/v2/orders/statuses \
    -u consumer_key:consumer_secret
WooCommerce.get('orders/statuses', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("orders/statuses").json())
<?php print_r($woocommerce->orders->get_statuses()); ?>
woocommerce.get("orders/statuses").parsed_response

JSON response example:

{
  "order_statuses": {
    "pending": "Pending Payment",
    "processing": "Processing",
    "on-hold": "On Hold",
    "completed": "Completed",
    "cancelled": "Cancelled",
    "refunded": "Refunded",
    "failed": "Failed"
  }
}

Create A Note For An Order

This API helps you to create a new note for an order.

HTTP Request

POST
/wc-api/v2/orders/<id>/notes
curl -X POST https://example.com/wc-api/v2/orders/645/notes \
    -u consumer_key:consumer_secret \
    -H "Content-Type: application/json" \
    -d '{
  "order_note": {
    "note": "Order ok!!!"
  }
}'
var data = {
  order_note: {
    note: 'Order ok!!!'
  }
};

WooCommerce.post('orders/645/notes', data, function(err, data, res) {
  console.log(res);
});
data = {
    "order_note": {
        "note": "Order ok!!!"
    }
}

print(wcapi.post("orders/645/notes", data).json())
<?php
$data = array(
    'order_note' => array(
        'note' => 'Order ok!!!'
    )
);

print_r($woocommerce->order_notes->create(645, $data));
?>
data = {
  order_note: {
    note: "Order ok!!!"
  }
}

woocommerce.post("orders/645/notes", data).parsed_response

JSON response example:

{
  "order_note": {
    "id": "416",
    "created_at": "2015-01-26T20:56:44Z",
    "note": "Order ok!!!",
    "customer_note": false
  }
}

Order Notes Properties

Attribute Type Description
id integer Order note ID read-only
created_at string UTC DateTime when the order note was created read-only
note string Order note required
customer_note boolean Shows/define if the note is only for reference or for the customer (the user will be notified). Default is false

View An Order Note

This API lets you retrieve and view a specific note from an order.

HTTP Request

GET
/wc-api/v2/orders/<id>/notes/<note_id>
curl https://example.com/wc-api/v2/orders/645/notes/416 \
    -u consumer_key:consumer_secret
WooCommerce.get('orders/645/notes/416', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("orders/645/notes/416").json())
<?php print_r($woocommerce->order_notes->get(645, 416)); ?>
woocommerce.get("orders/645/notes/416").parsed_response

JSON response example:

{
  "order_note": {
    "id": "416",
    "created_at": "2015-01-26T20:56:44Z",
    "note": "Order ok!!!",
    "customer_note": false
  }
}

View List Of Notes From An Order

This API helps you to view all the notes from an order.

HTTP Request

GET
/wc-api/v2/orders/<id>/notes
curl https://example.com/wc-api/v2/orders/645/notes \
    -u consumer_key:consumer_secret
WooCommerce.get('orders/645/notes', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("orders/645/notes").json())
<?php print_r($woocommerce->order_notes->get(645)); ?>
woocommerce.get("orders/645/notes").parsed_response

JSON response example:

{
  "order_notes": [
    {
      "id": "416",
      "created_at": "2015-01-26T20:56:44Z",
      "note": "Order ok!!!",
      "customer_note": false
    },
    {
      "id": "415",
      "created_at": "2015-01-26T20:16:14Z",
      "note": "Order status changed from Processing to Completed.",
      "customer_note": false
    },
    {
      "id": "412",
      "created_at": "2015-01-26T20:00:21Z",
      "note": "Order item stock reduced successfully.",
      "customer_note": false
    },
    {
      "id": "411",
      "created_at": "2015-01-26T20:00:09Z",
      "note": "Order status changed from Pending Payment to Processing.",
      "customer_note": false
    }
  ]
}

Update An Order Note

This API lets you make changes to an order note.

HTTP Request

PUT
/wc-api/v2/orders/<id>/notes/<note_id>
curl -X PUT https://example.com/wc-api/v2/orders/645/notes/416 \
    -u consumer_key:consumer_secret \
    -H "Content-Type: application/json" \
    -d '{
  "order_note": {
    "note": "Ok!"
  }
}'
var data = {
  order_note: {
    note: 'Ok!'
  }
};

WooCommerce.put('orders/645/notes/416', data, function(err, data, res) {
  console.log(res);
});
data = {
    "order_note": {
        "note": "Ok!"
    }
}

print(wcapi.put("orders/645/notes/416", data).json())
<?php
$data = array(
    'order_note' => array(
        'note' => 'Ok!'
    )
);

print_r($woocommerce->order_notes->update(645, 416, $data));
?>
data = {
  order_note: {
    note: "Ok!"
  }
}

woocommerce.put("orders/645/notes/416", data).parsed_response

JSON response example:

{
  "order_note": {
    "id": "416",
    "created_at": "2015-01-26T20:56:44Z",
    "note": "Ok!",
    "customer_note": false
  }
}

Delete An Order Note

This API helps you delete an order note.

HTTP Request

DELETE
/wc-api/v2/orders/<id>/notes/<note_id>
curl -X DELETE https://example.com/wc-api/v2/orders/645/notes/416 \
    -u consumer_key:consumer_secret
WooCommerce.delete('orders/645/notes/416', function(err, data, res) {
  console.log(res);
});
print(wcapi.delete("orders/645/notes/416").json())
<?php print_r($woocommerce->order_notes->delete(645, 416)); ?>
woocommerce.delete("orders/645/notes/416").parsed_response

JSON response example:

{
  "message": "Permanently deleted order note"
}

Create A Refund For An Order

This API helps you to create a new refund for an order.

HTTP Request

POST
/wc-api/v2/orders/<id>/refunds
curl -X POST https://example.com/wc-api/v2/orders/645/refunds \
    -u consumer_key:consumer_secret \
    -H "Content-Type: application/json" \
    -d '{
  "order_refund": {
    "amount": 10
  }
}'
var data = {
  order_refund: {
    amount: 10
  }
};

WooCommerce.post('orders/645/refunds', data, function(err, data, res) {
  console.log(res);
});
data = {
    "order_refund": {
        "amount": 10
    }
}

print(wcapi.post("orders/645/refunds", data).json())
<?php
$data = array(
    'order_refund' => array(
        'amount' => 10
    )
);

print_r($woocommerce->order_refunds->create(645, $data));
?>
data = {
  order_refund: {
    amount: 10
  }
}

woocommerce.post("orders/645/refunds", data).parsed_response

JSON response example:

{
  "order_refund": {
    "id": 649,
    "created_at": "2015-01-26T19:29:32Z",
    "amount": "10.00",
    "reason": "",
    "line_items": []
  }
}

Order Refunds Properties

Attribute Type Description
id integer Order note ID read-only
created_at string UTC DateTime when the order refund was created read-only
amount string Refund amount required
reason string Reason for refund
line_items array List of order items to refund. See Line Items Properties

View An Order Refund

This API lets you retrieve and view a specific refund from an order.

HTTP Request

GET
/wc-api/v2/orders/<id>/refunds/<refund_id>
curl https://example.com/wc-api/v2/orders/645/refunds/649 \
    -u consumer_key:consumer_secret
WooCommerce.get('orders/645/refunds/649', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("orders/645/refunds/649").json())
<?php print_r($woocommerce->order_refunds->get(645, 649)); ?>
woocommerce.get("orders/645/refunds/649").parsed_response

JSON response example:

{
  "order_refund": {
    "id": 649,
    "created_at": "2015-01-26T19:29:32Z",
    "amount": "10.00",
    "reason": "",
    "line_items": []
  }
}

View List Of Refunds From An Order

This API helps you to view all the refunds from an order.

HTTP Request

GET
/wc-api/v2/orders/<id>/refunds
curl https://example.com/wc-api/v2/orders/645/refunds \
    -u consumer_key:consumer_secret
WooCommerce.get('orders/645/refunds', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("orders/645/refunds").json())
<?php print_r($woocommerce->order_refunds->get(645)); ?>
woocommerce.get("orders/645/refunds").parsed_response

JSON response example:

{
  "order_refunds": [
    {
      "id": 649,
      "created_at": "2015-01-26T19:29:32Z",
      "amount": "10.00",
      "reason": "",
      "line_items": []
    },
    {
      "id": 647,
      "created_at": "2015-01-26T19:19:06Z",
      "amount": "21.99",
      "reason": "",
      "line_items": [
        {
          "id": 514,
          "subtotal": "-21.99",
          "subtotal_tax": "0.00",
          "total": "-21.99",
          "total_tax": "0.00",
          "price": "-21.99",
          "quantity": 1,
          "tax_class": "reduced-rate",
          "name": "Premium Quality",
          "product_id": 546,
          "sku": "",
          "meta": []
        },
        {
          "id": 515,
          "subtotal": "0.00",
          "subtotal_tax": "0.00",
          "total": "0.00",
          "total_tax": "0.00",
          "price": "0.00",
          "quantity": 0,
          "tax_class": null,
          "name": "Ship Your Idea",
          "product_id": 613,
          "sku": "",
          "meta": []
        }
      ]
    }
  ]
}

Update An Order Refund

This API lets you make changes to an order refund.

HTTP Request

PUT
/wc-api/v2/orders/<id>/refunds/<refund_id>
curl -X PUT https://example.com/wc-api/v2/orders/645/refunds/649 \
    -u consumer_key:consumer_secret \
    -H "Content-Type: application/json" \
    -d '{
  "order_refund": {
    "reason": "Because was it necessary!"
  }
}'
var data = {
  order_refund: {
    reason: 'Because was it necessary!'
  }
};

WooCommerce.put('orders/645/refunds/649', data, function(err, data, res) {
  console.log(res);
});
data = {
    "order_refund": {
        "reason": "Because was it necessary!"
    }
}

print(wcapi.put("orders/645/refunds/649", data).json())
<?php
$data = array(
    'order_refund' => array(
        'reason' => 'Because was it necessary!'
    )
);

print_r($woocommerce->order_refunds->update(645, 649, $data));
?>
data = {
  order_refund: {
    reason: "Because was it necessary!"
  }
}

woocommerce.put("orders/645/refunds/649", data).parsed_response

JSON response example:

{
  "order_refund": {
    "id": 649,
    "created_at": "2015-01-26T19:29:32Z",
    "amount": "10.00",
    "reason": "Because was it necessary!",
    "line_items": []
  }
}

Delete An Order Refund

This API helps you delete an order refund.

HTTP Request

DELETE
/wc-api/v2/orders/<id>/refunds/<refund_id>
curl -X DELETE https://example.com/wc-api/v2/orders/645/refunds/649 \
    -u consumer_key:consumer_secret
WooCommerce.delete('orders/645/refunds/649', function(err, data, res) {
  console.log(res);
});
print(wcapi.delete("orders/645/refunds/649").json())
<?php print_r($woocommerce->order_refunds->delete(645, 649)); ?>
woocommerce.delete("orders/645/refunds/649").parsed_response

JSON response example:

{
  "message": "Permanently deleted refund"
}

Products

This section lists all API that can be used to create, edit or otherwise manipulate products.

Products Properties

Attribute Type Description
title string Product name
id integer Product ID (post ID) read-only
created_at string UTC DateTime when the product was created read-only
updated_at string UTC DateTime when the product was last updated read-only
type string Product type. By default in WooCommerce the following types are available: simple, grouped, external, variable. Default is simple
status string Product status (post status). Default is publish
downloadable boolean If the product is downloadable or not. Downloadable products give access to a file upon purchase
virtual boolean If the product is virtual or not. Virtual products are intangible and aren’t shipped
permalink string Product URL (post permalink) read-only
sku string SKU refers to a Stock-keeping unit, a unique identifier for each distinct product and service that can be purchased
price string Current product price. This is setted from regular_price and sale_price read-only
regular_price string Product regular price
sale_price string Product sale price
sale_price_dates_from string Sets the sale start date. Date in the YYYY-MM-DD format write-only
sale_price_dates_to string Sets the sale end date. Date in the YYYY-MM-DD format write-only
price_html string Price formatted in HTML, e.g. <del><span class=\"amount\">&#36;&nbsp;3.00</span></del> <ins><span class=\"amount\">&#36;&nbsp;2.00</span></ins> read-only
taxable boolean Show if the product is taxable or not read-only
tax_status string Tax status. The options are: taxable, shipping (Shipping only) and none
tax_class string Tax class
managing_stock boolean Enable stock management at product level
stock_quantity integer Stock quantity. If is a variable product this value will be used to control stock for all variations, unless you define stock at variation level.
in_stock boolean Controls whether or not the product is listed as “in stock” or “out of stock” on the frontend.
backorders_allowed boolean Shows if backorders are allowed read-only
backordered boolean Shows if a product is on backorder (if the product have the stock_quantity negative) read-only
backorders mixed If managing stock, this controls whether or not backorders are allowed. If enabled, stock quantity can go below 0. The options are: false (Do not allow), notify (Allow, but notify customer), and true (Allow) write-only
sold_individually boolean When true this only allow one item to be bought in a single order
purchaseable boolean Shows if the product can be bought read-only
featured boolean Featured Product
visible boolean Shows whether or not the product is visible in the catalog read-only
catalog_visibility string Catalog visibility. The following options are available: visible (Catalog and search), catalog (Only in catalog), search (Only in search) and hidden (Hidden from all). Default is visible
on_sale boolean Shows if the product is on sale or not read-only
weight string Product weight in decimal format
dimensions array List of the product dimensions. See Dimensions Properties
shipping_required boolean Shows if the product need to be shipped or not read-only
shipping_taxable boolean Shows whether or not the product shipping is taxable read-only
shipping_class string Shipping class slug. Shipping classes are used by certain shipping methods to group similar products
shipping_class_id integer Shipping class ID read-only
description string Product description
enable_html_description bool Enable HTML for product description write-only
short_description string Product short description
enable_html_short_description string Enable HTML for product short description write-only
reviews_allowed boolean Shows/define if reviews are allowed
average_rating string Reviews average rating read-only
rating_count integer Amount of reviews that the product have read-only
related_ids array List of related products IDs (integer) read-only
upsell_ids array List of up-sell products IDs (integer). Up-sells are products which you recommend instead of the currently viewed product, for example, products that are more profitable or better quality or more expensive
cross_sell_ids array List of cross-sell products IDs. Cross-sells are products which you promote in the cart, based on the current product
parent_id integer Product parent ID (post_parent)
categories array List of product categories names (string). In write-mode need to pass a array of categories IDs (integer) (uses wp_set_object_terms())
tags array List of product tags names (string). In write-mode need to pass a array of tags IDs (integer) (uses wp_set_object_terms())
images array List of products images. See Images Properties
featured_src string Featured image URL read-only
attributes array List of product attributes. See Attributes Properties. Note: the attribute must be registered in WooCommerce before.
default_attributes array Defaults variation attributes. These are the attributes that will be pre-selected on the frontend. See Default Attributes Properties write-only
downloads array List of downloadable files. See Downloads Properties
download_limit integer Amount of times the product can be downloaded. In write-mode you can sent a blank string for unlimited re-downloads. e.g ''
download_expiry integer Number of days that the customer has up to be able to download the product. In write-mode you can sent a blank string for never expiry. e.g ''
download_type string Download type, this controls the schema. The available options are: '' (Standard Product), application (Application/Software) and music (Music)
purchase_note string Optional note to send the customer after purchase.
total_sales integer Amount of sales read-only
variations array List of products variations. See Variations Properties
parent array List the product parent data when query for a variation read-only
product_url string Product external URL. Only for external products write-only
button_text string Product external button text. Only for external products write-only

Dimensions Properties

Attribute Type Description
length string Product length in decimal format
width string Product width in decimal format
height string Product height in decimal format
unit string Product name read-only

Images Properties

Attribute Type Description
id integer Image ID (attachment ID)
created_at string UTC DateTime when the image was created read-only
updated_at string UTC DateTime when the image was last updated read-only
src string Image URL. In write-mode you can use to send new images
title string Image title (attachment title) read-only
alt string Image alt text (attachment image alt text) read-only
position integer Image position. 0 means that the image is featured

Attributes Properties

Attribute Type Description
name string Attribute name required
slug string Attribute slug
position integer Attribute position
visible boolean Shows/define if the attribute is visible on the “Additional Information” tab in the product’s page
variation boolean Shows/define if the attribute can be used as variation
options array List of available term names of the attribute

Default Attributes Properties

Attribute Type Description
name string Attribute name
slug string Attribute slug
option string Selected term name of the attribute

Downloads Properties

Attribute Type Description
id string File ID (file md5 hash) read-only
name string File name
file string File URL. In write-mode you can use this property to send new files

Variations Properties

Attribute Type Description
id integer Variation ID (post ID) read-only
created_at string UTC DateTime when the variation was created read-only
updated_at string UTC DateTime when the variation was last updated read-only
downloadable boolean If the variation is downloadable or not. Downloadable variations give access to a file upon purchase
virtual boolean If the variation is virtual or not. Virtual variations are intangible and aren’t shipped
permalink string Variation URL (post permalink) read-only
sku string SKU refers to a Stock-keeping unit, a unique identifier for each distinct product and service that can be purchased
price string Current variation price. This is setted from regular_price and sale_price read-only
regular_price string Variation regular price
sale_price string Variation sale price
sale_price_dates_from string Sets the sale start date. Date in the YYYY-MM-DD format write-only
sale_price_dates_to string Sets the sale end date. Date in the YYYY-MM-DD format write-only
taxable boolean Show if the variation is taxable or not read-only
tax_status string Tax status. The options are: taxable, shipping (Shipping only) and none
tax_class string Tax class
managing_stock boolean Enable stock management at variation level
stock_quantity integer Stock quantity. If is a variable variation this value will be used to control stock for all variations, unless you define stock at variation level.
in_stock boolean Controls whether or not the variation is listed as “in stock” or “out of stock” on the frontend.
backordered boolean Shows if a variation is on backorder (if the variation have the stock_quantity negative) read-only
purchaseable boolean Shows if the variation can be bought read-only
visible boolean Shows whether or not the product parent is visible in the catalog read-only
on_sale boolean Shows if the variation is on sale or not read-only
weight string Variation weight in decimal format
dimensions array List of the variation dimensions. See Dimensions Properties
shipping_class string Shipping class slug. Shipping classes are used by certain shipping methods to group similar products
shipping_class_id integer Shipping class ID read-only
image array Variation featured image. See Images Properties
attributes array List of variation attributes. Similar to a simple or variable product, but for variation indicate the attributes used to form the variation. See Attributes Properties
downloads array List of downloadable files. See Downloads Properties
download_limit integer Amount of times the variation can be downloaded. In write-mode you can sent a blank string for unlimited re-downloads. e.g ''
download_expiry integer Number of days that the customer has up to be able to download the varition. In write-mode you can sent a blank string for never expiry. e.g ''

Create A Product

This API helps you to create a new product.

HTTP Request

POST
/wc-api/v2/products

Example of how to create a simple product:

curl -X POST https://example.com/wc-api/v2/products \
    -u consumer_key:consumer_secret \
    -H "Content-Type: application/json" \
    -d '{
  "product": {
    "title": "Premium Quality",
    "type": "simple",
    "regular_price": "21.99",
    "description": "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",
    "short_description": "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.",
    "categories": [
      9,
      14
    ],
    "images": [
      {
        "src": "http://example.com/wp-content/uploads/2015/01/premium-quality-front.jpg",
        "position": 0
      },
      {
        "src": "http://example.com/wp-content/uploads/2015/01/premium-quality-back.jpg",
        "position": 1
      }
    ]
  }
}'
var data = {
  product: {
    title: 'Premium Quality',
    type: 'simple',
    regular_price: '21.99',
    description: 'Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.',
    short_description: 'Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.',
    categories: [
      9,
      14
    ],
    images: [
      {
        src: 'http://example.com/wp-content/uploads/2015/01/premium-quality-front.jpg',
        position: 0
      },
      {
        src: 'http://example.com/wp-content/uploads/2015/01/premium-quality-back.jpg',
        position: 1
      }
    ]
  }
};

WooCommerce.post('products', data, function(err, data, res) {
  console.log(res);
});
data = {
    "product": {
        "title": "Premium Quality",
        "type": "simple",
        "regular_price": "21.99",
        "description": "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",
        "short_description": "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.",
        "categories": [
            9,
            14
        ],
        "images": [
            {
                "src": "http://example.com/wp-content/uploads/2015/01/premium-quality-front.jpg",
                "position": 0
            },
            {
                "src": "http://example.com/wp-content/uploads/2015/01/premium-quality-back.jpg",
                "position": 1
            }
        ]
    }
}

print(wcapi.post("products", data).json())
<?php
$data = array(
    'product' => array(
        'title' => 'Premium Quality',
        'type' => 'simple',
        'regular_price' => '21.99',
        'description' => 'Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.',
        'short_description' => 'Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.',
        'categories' => array(
            9,
            14
        ),
        'images' => array(
            array(
                'src' => 'http =>//example.com/wp-content/uploads/2015/01/premium-quality-front.jpg',
                'position' => 0
            ),
            array(
                'src' => 'http =>//example.com/wp-content/uploads/2015/01/premium-quality-back.jpg',
                'position' => 1
            )
        )
    )
);

print_r($woocommerce->products->create($data));
?>
data = {
  product: {
    title: "Premium Quality",
    type: "simple",
    regular_price: "21.99",
    description: "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",
    short_description: "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.",
    categories: [
      9,
      14
    ],
    images: [
      {
        src: "http://example.com/wp-content/uploads/2015/01/premium-quality-front.jpg",
        position: 0
      },
      {
        src: "http://example.com/wp-content/uploads/2015/01/premium-quality-back.jpg",
        position: 1
      }
    ]
  }
}

woocommerce.post("products", data).parsed_response

JSON response example:

{
  "product": {
    "title": "Premium Quality",
    "id": 546,
    "created_at": "2015-01-22T19:46:16Z",
    "updated_at": "2015-01-22T19:46:16Z",
    "type": "simple",
    "status": "publish",
    "downloadable": false,
    "virtual": false,
    "permalink": "https://example.com/product/premium-quality/",
    "sku": "",
    "price": "21.99",
    "regular_price": "21.99",
    "sale_price": null,
    "price_html": "<span class=\"amount\">&#36;&nbsp;21.99</span>",
    "taxable": true,
    "tax_status": "taxable",
    "tax_class": "",
    "managing_stock": false,
    "stock_quantity": 0,
    "in_stock": true,
    "backorders_allowed": false,
    "backordered": false,
    "sold_individually": false,
    "purchaseable": true,
    "featured": false,
    "visible": true,
    "catalog_visibility": "visible",
    "on_sale": false,
    "weight": null,
    "dimensions": {
      "length": "",
      "width": "",
      "height": "",
      "unit": "cm"
    },
    "shipping_required": true,
    "shipping_taxable": true,
    "shipping_class": "",
    "shipping_class_id": null,
    "description": "<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>\n",
    "short_description": "<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>\n",
    "reviews_allowed": true,
    "average_rating": "0.00",
    "rating_count": 0,
    "related_ids": [
      37,
      47,
      31,
      19,
      22
    ],
    "upsell_ids": [],
    "cross_sell_ids": [],
    "parent_id": 0,
    "categories": [
      "Clothing",
      "T-shirts"
    ],
    "tags": [],
    "images": [
      {
        "id": 547,
        "created_at": "2015-01-22T19:46:16Z",
        "updated_at": "2015-01-22T19:46:16Z",
        "src": "http://example.com/wp-content/uploads/2015/01/premium-quality-front.jpg",
        "title": "",
        "alt": "",
        "position": 0
      },
      {
        "id": 548,
        "created_at": "2015-01-22T19:46:17Z",
        "updated_at": "2015-01-22T19:46:17Z",
        "src": "http://example.com/wp-content/uploads/2015/01/premium-quality-back.jpg",
        "title": "",
        "alt": "",
        "position": 1
      }
    ],
    "featured_src": "http://example.com/wp-content/uploads/2015/01/premium-quality-front.jpg",
    "attributes": [],
    "downloads": [],
    "download_limit": 0,
    "download_expiry": 0,
    "download_type": "",
    "purchase_note": "",
    "total_sales": 0,
    "variations": [],
    "parent": []
  }
}

Example of how to create a variable product:

curl -X POST https://example.com/wc-api/v2/products \
    -u consumer_key:consumer_secret \
    -H "Content-Type: application/json" \
    -d '{
  "product": {
    "title": "Ship Your Idea",
    "type": "variable",
    "description": "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",
    "short_description": "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.",
    "categories": [
      9,
      14
    ],
    "images": [
      {
        "src": "http://example.com/wp-content/uploads/2015/01/ship-your-idea-black-front.jpg",
        "position": 0
      },
      {
        "src": "http://example.com/wp-content/uploads/2015/01/ship-your-idea-black-back.jpg",
        "position": 1
      },
      {
        "src": "http://example.com/wp-content/uploads/2015/01/ship-your-idea-green-front.jpg",
        "position": 2
      },
      {
        "src": "http://example.com/wp-content/uploads/2015/01/ship-your-idea-green-back.jpg",
        "position": 3
      }
    ],
    "attributes": [
      {
        "name": "Color",
        "slug": "color",
        "position": "0",
        "visible": false,
        "variation": true,
        "options": [
          "Black",
          "Green"
        ]
      }
    ],
    "default_attributes": [
      {
        "name": "Color",
        "slug": "color",
        "option": "Black"
      }
    ],
    "variations": [
      {
        "regular_price": "19.99",
        "image": [
          {
            "src": "http://example.com/wp-content/uploads/2015/01/ship-your-idea-black-front.jpg",
            "position": 0
          }
        ],
        "attributes": [
          {
            "name": "Color",
            "slug": "color",
            "option": "black"
          }
        ]
      },
      {
        "regular_price": "19.99",
        "image": [
          {
            "src": "http://example.com/wp-content/uploads/2015/01/ship-your-idea-green-front.jpg",
            "position": 0
          }
        ],
        "attributes": [
          {
            "name": "Color",
            "slug": "color",
            "option": "green"
          }
        ]
      }
    ]
  }
}'
var data = {
  product: {
    title: 'Ship Your Idea',
    type: 'variable',
    description: 'Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.',
    short_description: 'Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.',
    categories: [
      9,
      14
    ],
    images: [
      {
        src: 'http://example.com/wp-content/uploads/2015/01/ship-your-idea-black-front.jpg',
        position: 0
      },
      {
        src: 'http://example.com/wp-content/uploads/2015/01/ship-your-idea-black-back.jpg',
        position: 1
      },
      {
        src: 'http://example.com/wp-content/uploads/2015/01/ship-your-idea-green-front.jpg',
        position: 2
      },
      {
        src: 'http://example.com/wp-content/uploads/2015/01/ship-your-idea-green-back.jpg',
        position: 3
      }
    ],
    attributes: [
      {
        name: 'Color',
        slug: 'color',
        position: '0',
        visible: false,
        variation: true,
        options: [
          'Black',
          'Green'
        ]
      }
    ],
    default_attributes: [
      {
        name: 'Color',
        slug: 'color',
        option: 'Black'
      }
    ],
    variations: [
      {
        regular_price: '19.99',
        image: [
          {
            src: 'http://example.com/wp-content/uploads/2015/01/ship-your-idea-black-front.jpg',
            position: 0
          }
        ],
        attributes: [
          {
            name: 'Color',
            slug: 'color',
            option: 'black'
          }
        ]
      },
      {
        regular_price: '19.99',
        image: [
          {
            src: 'http://example.com/wp-content/uploads/2015/01/ship-your-idea-green-front.jpg',
            position: 0
          }
        ],
        attributes: [
          {
            name: 'Color',
            slug: 'color',
            option: 'green'
          }
        ]
      }
    ]
  }
};

WooCommerce.post('products', data, function(err, data, res) {
  console.log(res);
});
data = {
    "product": {
        "title": "Ship Your Idea",
        "type": "variable",
        "description": "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",
        "short_description": "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.",
        "categories": [
            9,
            14
        ],
        "images": [
            {
                "src": "http://example.com/wp-content/uploads/2015/01/ship-your-idea-black-front.jpg",
                "position": 0
            },
            {
                "src": "http://example.com/wp-content/uploads/2015/01/ship-your-idea-black-back.jpg",
                "position": 1
            },
            {
                "src": "http://example.com/wp-content/uploads/2015/01/ship-your-idea-green-front.jpg",
                "position": 2
            },
            {
                "src": "http://example.com/wp-content/uploads/2015/01/ship-your-idea-green-back.jpg",
                "position": 3
            }
        ],
        "attributes": [
            {
                "name": "Color",
                "slug": "color",
                "position": "0",
                "visible": False,
                "variation": True,
                "options": [
                    "Black",
                    "Green"
                ]
            }
        ],
        "default_attributes": [
            {
                "name": "Color",
                "slug": "color",
                "option": "Black"
            }
        ],
        "variations": [
            {
                "regular_price": "19.99",
                "image": [
                    {
                        "src": "http://example.com/wp-content/uploads/2015/01/ship-your-idea-black-front.jpg",
                        "position": 0
                    }
                ],
                "attributes": [
                    {
                        "name": "Color",
                        "slug": "color",
                        "option": "black"
                    }
                ]
            },
            {
                "regular_price": "19.99",
                "image": [
                    {
                        "src": "http://example.com/wp-content/uploads/2015/01/ship-your-idea-green-front.jpg",
                        "position": 0
                    }
                ],
                "attributes": [
                    {
                        "name": "Color",
                        "slug": "color",
                        "option": "green"
                    }
                ]
            }
        ]
    }
}

print(wcapi.post("products", data).json())
<?php
$data = array(
    'product' => array(
        'title' => 'Ship Your Idea',
        'type' => 'variable',
        'description' => 'Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.',
        'short_description' => 'Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.',
        'categories' => array(
            9,
            14
        ),
        'images' => array(
            array(
                'src' => 'http://example.com/wp-content/uploads/2015/01/ship-your-idea-black-front.jpg',
                'position' => 0
            ),
            array(
                'src' => 'http://example.com/wp-content/uploads/2015/01/ship-your-idea-black-back.jpg',
                'position' => 1
            ),
            array(
                'src' => 'http://example.com/wp-content/uploads/2015/01/ship-your-idea-green-front.jpg',
                'position' => 2
            ),
            array(
                'src' => 'http://example.com/wp-content/uploads/2015/01/ship-your-idea-green-back.jpg',
                'position' => 3
            )
        ),
        'attributes' => array(
            array(
                'name' => 'Color',
                'slug' => 'color',
                'position' => '0',
                'visible' => False,
                'variation' => True,
                'options' => array(
                    'Black',
                    'Green'
                )
            )
        ),
        'default_attributes' => array(
            array(
                'name' => 'Color',
                'slug' => 'color',
                'option' => 'Black'
            )
        ),
        'variations' => array(
            array(
                'regular_price' => '19.99',
                'image' => array(
                    array(
                        'src' => 'http://example.com/wp-content/uploads/2015/01/ship-your-idea-black-front.jpg',
                        'position' => 0
                    )
                ),
                'attributes' => array(
                    array(
                        'name' => 'Color',
                        'slug' => 'color',
                        'option' => 'black'
                    )
                )
            ),
            array(
                'regular_price' => '19.99',
                'image' => array(
                    array(
                        'src' => 'http://example.com/wp-content/uploads/2015/01/ship-your-idea-green-front.jpg',
                        'position' => 0
                    )
                ),
                'attributes' => array(
                    array(
                        'name' => 'Color',
                        'slug' => 'color',
                        'option' => 'green'
                    )
                )
            )
        )
    )
);

print_r($woocommerce->products->create($data));
?>
data = {
  product: {
    title: "Ship Your Idea",
    type: "variable",
    description: "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",
    short_description: "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.",
    categories: [
      9,
      14
    ],
    images: [
      {
        src: "http://example.com/wp-content/uploads/2015/01/ship-your-idea-black-front.jpg",
        position: 0
      },
      {
        src: "http://example.com/wp-content/uploads/2015/01/ship-your-idea-black-back.jpg",
        position: 1
      },
      {
        src: "http://example.com/wp-content/uploads/2015/01/ship-your-idea-green-front.jpg",
        position: 2
      },
      {
        src: "http://example.com/wp-content/uploads/2015/01/ship-your-idea-green-back.jpg",
        position: 3
      }
    ],
    attributes: [
      {
        name: "Color",
        slug: "color",
        position: "0",
        visible: false,
        variation: true,
        options: [
          "Black",
          "Green"
        ]
      }
    ],
    default_attributes: [
      {
        name: "Color",
        slug: "color",
        option: "Black"
      }
    ],
    variations: [
      {
        regular_price: "19.99",
        image: [
          {
            src: "http://example.com/wp-content/uploads/2015/01/ship-your-idea-black-front.jpg",
            position: 0
          }
        ],
        attributes: [
          {
            name: "Color",
            slug: "color",
            option: "black"
          }
        ]
      },
      {
        regular_price: "19.99",
        image: [
          {
            src: "http://example.com/wp-content/uploads/2015/01/ship-your-idea-green-front.jpg",
            position: 0
          }
        ],
        attributes: [
          {
            name: "Color",
            slug: "color",
            option: "green"
          }
        ]
      }
    ]
  }
}

woocommerce.post("products", data).parsed_response

JSON response example:

{
  "product": {
    "title": "Ship Your Idea",
    "id": 604,
    "created_at": "2015-01-22T20:37:14Z",
    "updated_at": "2015-01-22T20:37:14Z",
    "type": "variable",
    "status": "publish",
    "downloadable": false,
    "virtual": false,
    "permalink": "https://example/product/ship-your-idea/",
    "sku": "",
    "price": "19.99",
    "regular_price": "0.00",
    "sale_price": null,
    "price_html": "<span class=\"amount\">&#36;&nbsp;19.99</span>",
    "taxable": true,
    "tax_status": "taxable",
    "tax_class": "",
    "managing_stock": false,
    "stock_quantity": 0,
    "in_stock": true,
    "backorders_allowed": false,
    "backordered": false,
    "sold_individually": false,
    "purchaseable": true,
    "featured": false,
    "visible": true,
    "catalog_visibility": "visible",
    "on_sale": false,
    "weight": null,
    "dimensions": {
      "length": "",
      "width": "",
      "height": "",
      "unit": "cm"
    },
    "shipping_required": true,
    "shipping_taxable": true,
    "shipping_class": "",
    "shipping_class_id": null,
    "description": "<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>\n",
    "short_description": "<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>\n",
    "reviews_allowed": true,
    "average_rating": "0.00",
    "rating_count": 0,
    "related_ids": [
      40,
      37,
      47,
      577,
      34
    ],
    "upsell_ids": [],
    "cross_sell_ids": [],
    "parent_id": 0,
    "categories": [
      "Clothing",
      "T-shirts"
    ],
    "tags": [],
    "images": [
      {
        "id": 605,
        "created_at": "2015-01-22T20:37:14Z",
        "updated_at": "2015-01-22T20:37:14Z",
        "src": "http://example/wp-content/uploads/2015/01/ship-your-idea-black-front.jpg",
        "title": "",
        "alt": "",
        "position": 0
      },
      {
        "id": 606,
        "created_at": "2015-01-22T20:37:15Z",
        "updated_at": "2015-01-22T20:37:15Z",
        "src": "http://example/wp-content/uploads/2015/01/ship-your-idea-black-back.jpg",
        "title": "",
        "alt": "",
        "position": 1
      },
      {
        "id": 607,
        "created_at": "2015-01-22T20:37:15Z",
        "updated_at": "2015-01-22T20:37:15Z",
        "src": "http://example/wp-content/uploads/2015/01/ship-your-idea-green-front.jpg",
        "title": "",
        "alt": "",
        "position": 2
      },
      {
        "id": 608,
        "created_at": "2015-01-22T20:37:16Z",
        "updated_at": "2015-01-22T20:37:16Z",
        "src": "http://example/wp-content/uploads/2015/01/ship-your-idea-green-back.jpg",
        "title": "",
        "alt": "",
        "position": 3
      }
    ],
    "featured_src": "http://example/wp-content/uploads/2015/01/ship-your-idea-black-front.jpg",
    "attributes": [
      {
        "name": "Color",
        "slug": "color",
        "position": 0,
        "visible": false,
        "variation": true,
        "options": [
          "Black",
          "Green"
        ]
      }
    ],
    "downloads": [],
    "download_limit": 0,
    "download_expiry": 0,
    "download_type": "",
    "purchase_note": "",
    "total_sales": 0,
    "variations": [
      {
        "id": 609,
        "created_at": "2015-01-22T20:37:14Z",
        "updated_at": "2015-01-22T20:37:14Z",
        "downloadable": false,
        "virtual": false,
        "permalink": "https://example/product/ship-your-idea-10/?attribute_pa_color=black",
        "sku": "",
        "price": "19.99",
        "regular_price": "19.99",
        "sale_price": null,
        "taxable": true,
        "tax_status": "taxable",
        "tax_class": "",
        "managing_stock": false,
        "stock_quantity": 0,
        "in_stock": true,
        "backordered": false,
        "purchaseable": true,
        "visible": true,
        "on_sale": false,
        "weight": null,
        "dimensions": {
          "length": "",
          "width": "",
          "height": "",
          "unit": "cm"
        },
        "shipping_class": "",
        "shipping_class_id": null,
        "image": [
          {
            "id": 610,
            "created_at": "2015-01-22T20:37:18Z",
            "updated_at": "2015-01-22T20:37:18Z",
            "src": "http://example/wp-content/uploads/2015/01/ship-your-idea-black-front.jpg",
            "title": "",
            "alt": "",
            "position": 0
          }
        ],
        "attributes": [
          {
            "name": "Color",
            "slug": "color",
            "option": "black"
          }
        ],
        "downloads": [],
        "download_limit": 0,
        "download_expiry": 0
      },
      {
        "id": 611,
        "created_at": "2015-01-22T20:37:14Z",
        "updated_at": "2015-01-22T20:37:14Z",
        "downloadable": false,
        "virtual": false,
        "permalink": "https://example/product/ship-your-idea-10/?attribute_pa_color=green",
        "sku": "",
        "price": "19.99",
        "regular_price": "19.99",
        "sale_price": null,
        "taxable": true,
        "tax_status": "taxable",
        "tax_class": "",
        "managing_stock": false,
        "stock_quantity": 0,
        "in_stock": true,
        "backordered": false,
        "purchaseable": true,
        "visible": true,
        "on_sale": false,
        "weight": null,
        "dimensions": {
          "length": "",
          "width": "",
          "height": "",
          "unit": "cm"
        },
        "shipping_class": "",
        "shipping_class_id": null,
        "image": [
          {
            "id": 612,
            "created_at": "2015-01-22T20:37:19Z",
            "updated_at": "2015-01-22T20:37:19Z",
            "src": "http://example/wp-content/uploads/2015/01/ship-your-idea-green-front.jpg",
            "title": "",
            "alt": "",
            "position": 0
          }
        ],
        "attributes": [
          {
            "name": "Color",
            "slug": "color",
            "option": "green"
          }
        ],
        "downloads": [],
        "download_limit": 0,
        "download_expiry": 0
      }
    ],
    "parent": []
  }
}

View A Product

This API lets you retrieve and view a specific product by ID or sku.

HTTP Request

GET
/wc-api/v2/products/<id>
GET
/wc-api/v2/products/sku/<sku>
curl https://example.com/wc-api/v2/products/546 \
    -u consumer_key:consumer_secret
WooCommerce.get('products/546', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("products/546").json())
<?php print_r($woocommerce->products->get(546)); ?>
woocommerce.get("products/546").parsed_response

JSON response example:

{
  "product": {
    "title": "Premium Quality",
    "id": 546,
    "created_at": "2015-01-22T19:46:16Z",
    "updated_at": "2015-01-22T19:46:16Z",
    "type": "simple",
    "status": "publish",
    "downloadable": false,
    "virtual": false,
    "permalink": "https://example.com/product/premium-quality/",
    "sku": "",
    "price": "21.99",
    "regular_price": "21.99",
    "sale_price": null,
    "price_html": "<span class=\"amount\">&#36;&nbsp;21.99</span>",
    "taxable": true,
    "tax_status": "taxable",
    "tax_class": "",
    "managing_stock": false,
    "stock_quantity": 0,
    "in_stock": true,
    "backorders_allowed": false,
    "backordered": false,
    "sold_individually": false,
    "purchaseable": true,
    "featured": false,
    "visible": true,
    "catalog_visibility": "visible",
    "on_sale": false,
    "weight": null,
    "dimensions": {
      "length": "",
      "width": "",
      "height": "",
      "unit": "cm"
    },
    "shipping_required": true,
    "shipping_taxable": true,
    "shipping_class": "",
    "shipping_class_id": null,
    "description": "<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>\n",
    "short_description": "<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>\n",
    "reviews_allowed": true,
    "average_rating": "0.00",
    "rating_count": 0,
    "related_ids": [
      37,
      47,
      31,
      19,
      22
    ],
    "upsell_ids": [],
    "cross_sell_ids": [],
    "parent_id": 0,
    "categories": [
      "Clothing",
      "T-shirts"
    ],
    "tags": [],
    "images": [
      {
        "id": 547,
        "created_at": "2015-01-22T19:46:16Z",
        "updated_at": "2015-01-22T19:46:16Z",
        "src": "http://example.com/wp-content/uploads/2015/01/premium-quality-front.jpg",
        "title": "",
        "alt": "",
        "position": 0
      },
      {
        "id": 548,
        "created_at": "2015-01-22T19:46:17Z",
        "updated_at": "2015-01-22T19:46:17Z",
        "src": "http://example.com/wp-content/uploads/2015/01/premium-quality-back.jpg",
        "title": "",
        "alt": "",
        "position": 1
      }
    ],
    "featured_src": "http://example.com/wp-content/uploads/2015/01/premium-quality-front.jpg",
    "attributes": [],
    "downloads": [],
    "download_limit": 0,
    "download_expiry": 0,
    "download_type": "",
    "purchase_note": "",
    "total_sales": 0,
    "variations": [],
    "parent": []
  }
}

View List Of Products

This API helps you to view all the products.

HTTP Request

GET
/wc-api/v2/products
curl https://example.com/wc-api/v2/products \
    -u consumer_key:consumer_secret
WooCommerce.get('products', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("products").json())
<?php print_r($woocommerce->products->get()); ?>
woocommerce.get("products").parsed_response

JSON response example:

{
  "products": [
    {
      "title": "Premium Quality",
      "id": 546,
      "created_at": "2015-01-22T19:46:16Z",
      "updated_at": "2015-01-22T19:46:16Z",
      "type": "simple",
      "status": "publish",
      "downloadable": false,
      "virtual": false,
      "permalink": "https://example.com/product/premium-quality/",
      "sku": "",
      "price": "21.99",
      "regular_price": "21.99",
      "sale_price": null,
      "price_html": "<span class=\"amount\">&#36;&nbsp;21.99</span>",
      "taxable": true,
      "tax_status": "taxable",
      "tax_class": "",
      "managing_stock": false,
      "stock_quantity": 0,
      "in_stock": true,
      "backorders_allowed": false,
      "backordered": false,
      "sold_individually": false,
      "purchaseable": true,
      "featured": false,
      "visible": true,
      "catalog_visibility": "visible",
      "on_sale": false,
      "weight": null,
      "dimensions": {
        "length": "",
        "width": "",
        "height": "",
        "unit": "cm"
      },
      "shipping_required": true,
      "shipping_taxable": true,
      "shipping_class": "",
      "shipping_class_id": null,
      "description": "<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>\n",
      "short_description": "<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>\n",
      "reviews_allowed": true,
      "average_rating": "0.00",
      "rating_count": 0,
      "related_ids": [
        37,
        47,
        31,
        19,
        22
      ],
      "upsell_ids": [],
      "cross_sell_ids": [],
      "parent_id": 0,
      "categories": [
        "Clothing",
        "T-shirts"
      ],
      "tags": [],
      "images": [
        {
          "id": 547,
          "created_at": "2015-01-22T19:46:16Z",
          "updated_at": "2015-01-22T19:46:16Z",
          "src": "http://example.com/wp-content/uploads/2015/01/premium-quality-front.jpg",
          "title": "",
          "alt": "",
          "position": 0
        },
        {
          "id": 548,
          "created_at": "2015-01-22T19:46:17Z",
          "updated_at": "2015-01-22T19:46:17Z",
          "src": "http://example.com/wp-content/uploads/2015/01/premium-quality-back.jpg",
          "title": "",
          "alt": "",
          "position": 1
        }
      ],
      "featured_src": "http://example.com/wp-content/uploads/2015/01/premium-quality-front.jpg",
      "attributes": [],
      "downloads": [],
      "download_limit": 0,
      "download_expiry": 0,
      "download_type": "",
      "purchase_note": "",
      "total_sales": 0,
      "variations": [],
      "parent": []
    },
    {
      "title": "Ship Your Idea",
      "id": 604,
      "created_at": "2015-01-22T20:37:14Z",
      "updated_at": "2015-01-22T20:37:14Z",
      "type": "variable",
      "status": "publish",
      "downloadable": false,
      "virtual": false,
      "permalink": "https://example/product/ship-your-idea/",
      "sku": "",
      "price": "19.99",
      "regular_price": "0.00",
      "sale_price": null,
      "price_html": "<span class=\"amount\">&#36;&nbsp;19.99</span>",
      "taxable": true,
      "tax_status": "taxable",
      "tax_class": "",
      "managing_stock": false,
      "stock_quantity": 0,
      "in_stock": true,
      "backorders_allowed": false,
      "backordered": false,
      "sold_individually": false,
      "purchaseable": true,
      "featured": false,
      "visible": true,
      "catalog_visibility": "visible",
      "on_sale": false,
      "weight": null,
      "dimensions": {
        "length": "",
        "width": "",
        "height": "",
        "unit": "cm"
      },
      "shipping_required": true,
      "shipping_taxable": true,
      "shipping_class": "",
      "shipping_class_id": null,
      "description": "<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>\n",
      "short_description": "<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>\n",
      "reviews_allowed": true,
      "average_rating": "0.00",
      "rating_count": 0,
      "related_ids": [
        40,
        37,
        47,
        577,
        34
      ],
      "upsell_ids": [],
      "cross_sell_ids": [],
      "parent_id": 0,
      "categories": [
        "Clothing",
        "T-shirts"
      ],
      "tags": [],
      "images": [
        {
          "id": 605,
          "created_at": "2015-01-22T20:37:14Z",
          "updated_at": "2015-01-22T20:37:14Z",
          "src": "http://example/wp-content/uploads/2015/01/ship-your-idea-black-front.jpg",
          "title": "",
          "alt": "",
          "position": 0
        },
        {
          "id": 606,
          "created_at": "2015-01-22T20:37:15Z",
          "updated_at": "2015-01-22T20:37:15Z",
          "src": "http://example/wp-content/uploads/2015/01/ship-your-idea-black-back.jpg",
          "title": "",
          "alt": "",
          "position": 1
        },
        {
          "id": 607,
          "created_at": "2015-01-22T20:37:15Z",
          "updated_at": "2015-01-22T20:37:15Z",
          "src": "http://example/wp-content/uploads/2015/01/ship-your-idea-green-front.jpg",
          "title": "",
          "alt": "",
          "position": 2
        },
        {
          "id": 608,
          "created_at": "2015-01-22T20:37:16Z",
          "updated_at": "2015-01-22T20:37:16Z",
          "src": "http://example/wp-content/uploads/2015/01/ship-your-idea-green-back.jpg",
          "title": "",
          "alt": "",
          "position": 3
        }
      ],
      "featured_src": "http://example/wp-content/uploads/2015/01/ship-your-idea-black-front.jpg",
      "attributes": [
        {
          "name": "Color",
          "slug": "color",
          "position": 0,
          "visible": false,
          "variation": true,
          "options": [
            "Black",
            "Green"
          ]
        }
      ],
      "downloads": [],
      "download_limit": 0,
      "download_expiry": 0,
      "download_type": "",
      "purchase_note": "",
      "total_sales": 0,
      "variations": [
        {
          "id": 609,
          "created_at": "2015-01-22T20:37:14Z",
          "updated_at": "2015-01-22T20:37:14Z",
          "downloadable": false,
          "virtual": false,
          "permalink": "https://example/product/ship-your-idea-10/?attribute_pa_color=black",
          "sku": "",
          "price": "19.99",
          "regular_price": "19.99",
          "sale_price": null,
          "taxable": true,
          "tax_status": "taxable",
          "tax_class": "",
          "managing_stock": false,
          "stock_quantity": 0,
          "in_stock": true,
          "backordered": false,
          "purchaseable": true,
          "visible": true,
          "on_sale": false,
          "weight": null,
          "dimensions": {
            "length": "",
            "width": "",
            "height": "",
            "unit": "cm"
          },
          "shipping_class": "",
          "shipping_class_id": null,
          "image": [
            {
              "id": 610,
              "created_at": "2015-01-22T20:37:18Z",
              "updated_at": "2015-01-22T20:37:18Z",
              "src": "http://example/wp-content/uploads/2015/01/ship-your-idea-black-front.jpg",
              "title": "",
              "alt": "",
              "position": 0
            }
          ],
          "attributes": [
            {
              "name": "Color",
              "slug": "color",
              "option": "black"
            }
          ],
          "downloads": [],
          "download_limit": 0,
          "download_expiry": 0
        },
        {
          "id": 611,
          "created_at": "2015-01-22T20:37:14Z",
          "updated_at": "2015-01-22T20:37:14Z",
          "downloadable": false,
          "virtual": false,
          "permalink": "https://example/product/ship-your-idea-10/?attribute_pa_color=green",
          "sku": "",
          "price": "19.99",
          "regular_price": "19.99",
          "sale_price": null,
          "taxable": true,
          "tax_status": "taxable",
          "tax_class": "",
          "managing_stock": false,
          "stock_quantity": 0,
          "in_stock": true,
          "backordered": false,
          "purchaseable": true,
          "visible": true,
          "on_sale": false,
          "weight": null,
          "dimensions": {
            "length": "",
            "width": "",
            "height": "",
            "unit": "cm"
          },
          "shipping_class": "",
          "shipping_class_id": null,
          "image": [
            {
              "id": 612,
              "created_at": "2015-01-22T20:37:19Z",
              "updated_at": "2015-01-22T20:37:19Z",
              "src": "http://example/wp-content/uploads/2015/01/ship-your-idea-green-front.jpg",
              "title": "",
              "alt": "",
              "position": 0
            }
          ],
          "attributes": [
            {
              "name": "Color",
              "slug": "color",
              "option": "green"
            }
          ],
          "downloads": [],
          "download_limit": 0,
          "download_expiry": 0
        }
      ],
      "parent": []
    }
  ]
}

Available Filters

Filter Type Description
type string Products by type. eg: simple or variable
category string Products by category.
sku string Filter a product by SKU.

Update A Product

This API lets you make changes to a product.

HTTP Request

PUT
/wc-api/v2/products/<id>
curl -X PUT https://example.com/wc-api/v2/products/546 \
    -u consumer_key:consumer_secret \
    -H "Content-Type: application/json" \
    -d '{
  "product": {
    "regular_price": "24.54"
  }
}'
var data = {
  product: {
    regular_price: '24.54'
  }
};

WooCommerce.put('products/546', data, function(err, data, res) {
  console.log(res);
});
data = {
    "product": {
        "regular_price": "24.54"
    }
}

print(wcapi.put("products/546", data).json())
<?php
$data = array(
    'product' => array(
        'regular_price': '24.54'
    )
);

print_r($woocommerce->products->update(546, $data));
?>
data = {
  product: {
    regular_price: "24.54"
  }
}

woocommerce.put("products/546", data).parsed_response

JSON response example:

{
  "product": {
    "title": "Premium Quality",
    "id": 546,
    "created_at": "2015-01-22T19:46:16Z",
    "updated_at": "2015-01-22T19:55:31Z",
    "type": "simple",
    "status": "publish",
    "downloadable": false,
    "virtual": false,
    "permalink": "https://example.com/product/premium-quality/",
    "sku": "",
    "price": "24.54",
    "regular_price": "24.54",
    "sale_price": null,
    "price_html": "<span class=\"amount\">&#36;&nbsp;24.54</span>",
    "taxable": true,
    "tax_status": "taxable",
    "tax_class": "",
    "managing_stock": false,
    "stock_quantity": 0,
    "in_stock": true,
    "backorders_allowed": false,
    "backordered": false,
    "sold_individually": false,
    "purchaseable": true,
    "featured": false,
    "visible": true,
    "catalog_visibility": "visible",
    "on_sale": false,
    "weight": null,
    "dimensions": {
      "length": "",
      "width": "",
      "height": "",
      "unit": "cm"
    },
    "shipping_required": true,
    "shipping_taxable": true,
    "shipping_class": "",
    "shipping_class_id": null,
    "description": "<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>\n",
    "short_description": "<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>\n",
    "reviews_allowed": true,
    "average_rating": "0.00",
    "rating_count": 0,
    "related_ids": [
      37,
      47,
      31,
      19,
      22
    ],
    "upsell_ids": [],
    "cross_sell_ids": [],
    "parent_id": 0,
    "categories": [
      "Clothing",
      "T-shirts"
    ],
    "tags": [],
    "images": [
      {
        "id": 547,
        "created_at": "2015-01-22T19:46:16Z",
        "updated_at": "2015-01-22T19:46:16Z",
        "src": "http://example.com/wp-content/uploads/2015/01/premium-quality-front.jpg",
        "title": "",
        "alt": "",
        "position": 0
      },
      {
        "id": 548,
        "created_at": "2015-01-22T19:46:17Z",
        "updated_at": "2015-01-22T19:46:17Z",
        "src": "http://example.com/wp-content/uploads/2015/01/premium-quality-back.jpg",
        "title": "",
        "alt": "",
        "position": 1
      }
    ],
    "featured_src": "http://example.com/wp-content/uploads/2015/01/premium-quality-front.jpg",
    "attributes": [],
    "downloads": [],
    "download_limit": 0,
    "download_expiry": 0,
    "download_type": "",
    "purchase_note": "",
    "total_sales": 0,
    "variations": [],
    "parent": []
  }
}

Delete A Product

This API helps you delete a product.

HTTP Request

DELETE
/wc-api/v2/products/<id>
curl -X DELETE https://example.com/wc-api/v2/products/546/?force=true \
    -u consumer_key:consumer_secret
WooCommerce.delete('products/546/?force=true', function(err, data, res) {
  console.log(res);
});
print(wcapi.delete("products/546/?force=true").json())
<?php print_r($woocommerce->products->delete(546, true)); ?>
woocommerce.delete("products/546").parsed_response

JSON response example:

{
  "message": "Permanently deleted product"
}

Parameters

Parameter Type Description
force string Use true whether to permanently delete the product, defaults to false. Note that permanently deleting the product will return HTTP 200 rather than HTTP 202.

View Products Count

This API lets you retrieve a count of all products.

HTTP Request

GET
/wc-api/v2/products/count
curl https://example.com/wc-api/v2/products/count \
    -u consumer_key:consumer_secret
WooCommerce.get('products/count', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("products/count").json())
<?php print_r($woocommerce->products->get_count()); ?>
woocommerce.get("products/count").parsed_response

JSON response example:

{
  "count": 2
}

Available Filters

Filter Type Description
type string Products by type. eg: simple or variable
category string Products by category.

View List Of Product Reviews

GET
/wc-api/v2/products/<id>/reviews
curl https://example.com/wc-api/v2/products/546/reviews \
    -u consumer_key:consumer_secret
WooCommerce.get('products/546/reviews', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("products/546/reviews").json())
<?php print_r($woocommerce->products->get_reviews(546)); ?>
woocommerce.get("products/546/reviews").parsed_response

JSON response example:

{
  "product_reviews": [
    {
      "id": 4,
      "created_at": "2013-06-07T11:57:45Z",
      "review": "This t-shirt is awesome! Would recommend to everyone!\n\nI'm ordering mine next week",
      "rating": "5",
      "reviewer_name": "Andrew",
      "reviewer_email": "andrew@example.com",
      "verified": false
    },
    {
      "id": 3,
      "created_at": "2013-06-07T11:53:49Z",
      "review": "Wonderful quality, and an awesome design. WooThemes ftw!",
      "rating": "4",
      "reviewer_name": "Cobus Bester",
      "reviewer_email": "cobus@example.com",
      "verified": false
    }
  ]
}

Product Reviews Properties

Attribute Type Description
id integer Review ID (comment ID) read-only
created_at string UTC DateTime when the review was created read-only
rating string Review rating (0 to 5) read-only
reviewer_name string Reviewer name read-only
reviewer_email string Reviewer email read-only
verified boolean Shows if the reviewer bought the product or not read-only

View A Product Category

GET
/wc-api/v2/products/categories/<id>
curl https://example.com/wc-api/v2/products/categories/9 \
    -u consumer_key:consumer_secret
WooCommerce.get('products/categories/9', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("products/categories/9").json())
<?php print_r($woocommerce->products->get_categories(9)); ?>
woocommerce.get("products/categories/9").parsed_response

JSON response example:

{
  "product_category": {
    "id": 9,
    "name": "Clothing",
    "slug": "clothing",
    "parent": 0,
    "description": "",
    "display": "default",
    "image": "",
    "count": 23
  }
}

Product Category Properties

Attribute Type Description
id integer Category ID (term ID) read-only
name string Category Name read-only
slug string Category slug read-only
parent integer Category parent read-only
description string Category description read-only
display string Category archive display type, the types available include: default, products, subcategories and both read-only
image string Category image URL read-only
count integer Shows the quantity of products in this category read-only

View List Of Product Categories

GET
/wc-api/v3/products/categories
curl https://example.com/wc-api/v3/products/categories \
    -u consumer_key:consumer_secret
WooCommerce.get('products/categories', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("products/categories").json())
<?php print_r($woocommerce->products->get_categories()); ?>
woocommerce.get("products/categories").parsed_response

JSON response example:

{
  "product_categories": [
    {
      "id": 15,
      "name": "Albums",
      "slug": "albums",
      "parent": 11,
      "description": "",
      "display": "default",
      "image": "",
      "count": 4
    },
    {
      "id": 9,
      "name": "Clothing",
      "slug": "clothing",
      "parent": 0,
      "description": "",
      "display": "default",
      "image": "",
      "count": 23
    },
    {
      "id": 10,
      "name": "Hoodies",
      "slug": "hoodies",
      "parent": 9,
      "description": "",
      "display": "default",
      "image": "",
      "count": 6
    },
    {
      "id": 11,
      "name": "Music",
      "slug": "music",
      "parent": 0,
      "description": "",
      "display": "default",
      "image": "",
      "count": 6
    },
    {
      "id": 12,
      "name": "Posters",
      "slug": "posters",
      "parent": 0,
      "description": "",
      "display": "default",
      "image": "",
      "count": 5
    },
    {
      "id": 13,
      "name": "Singles",
      "slug": "singles",
      "parent": 11,
      "description": "",
      "display": "default",
      "image": "",
      "count": 2
    },
    {
      "id": 14,
      "name": "T-shirts",
      "slug": "t-shirts",
      "parent": 9,
      "description": "",
      "display": "default",
      "image": "",
      "count": 17
    }
  ]
}

Reports

This section lists all API that can be used view reports.

Reports Filters

Use the following filters for any type of report to specify the period of sales:

Filter Type Description
period string The supported periods are: week, month, last_month, and year. If you use an invalid period, week is used. If you don’t specify a period, the current day is used
date_min string Return sales for a specific start date. The date need to be in the YYYY-MM-DD format
date_max string Return sales for a specific end date. The dates need to be in the YYYY-MM-DD format. Required to set the filter[date_min] too

View List Of Reports

This API lets you retrieve and view a simple list of available reports.

HTTP Request

GET
/wc-api/v2/reports
curl https://example.com/wc-api/v2/reports \
    -u consumer_key:consumer_secret
WooCommerce.get('reports', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("reports").json())
<?php print_r($woocommerce->reports->get()); ?>
woocommerce.get("reports").parsed_response

JSON response example:

{
  "reports": [
    "sales",
    "sales/top_sellers"
  ]
}

View List Of Sales Report

This API lets you retrieve and view a list of sales report.

HTTP Request

GET
/wc-api/v2/reports/sales
curl https://example.com/wc-api/v2/reports/sales?filter[date_min]=2015-01-18&filter[date_max]=2015-01-21 \
    -u consumer_key:consumer_secret
WooCommerce.get('reports/sales?filter[date_min]=2015-01-18&filter[date_max]=2015-01-21', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("reports/sales?filter[date_min]=2015-01-18&filter[date_max]=2015-01-21").json())
<?php
$args = array(
    'filter' => array(
        'date_min' => '2015-01-18',
        'date_max' => '2015-01-21'
    )
);

print_r($woocommerce->reports->get_sales($args));
?>
woocommerce.get("reports/sales?filter[date_min]=2015-01-18&filter[date_max]=2015-01-21").parsed_response

JSON response example:

{
  "sales": {
    "total_sales": "580.10",
    "average_sales": "145.03",
    "total_orders": 4,
    "total_items": 31,
    "total_tax": "26.10",
    "total_shipping": "20.00",
    "total_discount": "0.00",
    "totals_grouped_by": "day",
    "totals": {
      "2015-01-18": {
        "sales": "-17.00",
        "orders": 1,
        "items": 1,
        "tax": "0.00",
        "shipping": "0.00",
        "discount": "0.00",
        "customers": 0
      },
      "2015-01-19": {
        "sales": "0.00",
        "orders": 0,
        "items": 0,
        "tax": "0.00",
        "shipping": "0.00",
        "discount": "0.00",
        "customers": 0
      },
      "2015-01-20": {
        "sales": "0.00",
        "orders": 0,
        "items": 0,
        "tax": "0.00",
        "shipping": "0.00",
        "discount": "0.00",
        "customers": 0
      },
      "2015-01-21": {
        "sales": "597.10",
        "orders": 3,
        "items": 30,
        "tax": "26.10",
        "shipping": "20.00",
        "discount": "0.00",
        "customers": 0
      }
    },
    "total_customers": 0
  }
}

View List Of Top Sellers Report

This API lets you retrieve and view a list of top sellers report.

HTTP Request

GET
/wc-api/v2/reports/sales/top_sellers
curl https://example.com/wc-api/v2/reports/sales/top_sellers?filter[period]=last_month \
    -u consumer_key:consumer_secret
WooCommerce.get('reports/sales/top_sellers?filter[period]=last_month', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("reports/sales/top_sellers?filter[period]=last_month").json())
<?php
$args = array(
    'filter' => array(
        'period' => 'last_month'
    )
);

print_r($woocommerce->reports->get_top_sellers($args));
?>
woocommerce.get("reports/sales/top_sellers?filter[period]=last_month").parsed_response

JSON response example:

{
  "top_sellers": [
    {
      "title": "Happy Ninja",
      "product_id": "37",
      "quantity": "24"
    },
    {
      "title": "Flying Ninja",
      "product_id": "70",
      "quantity": "14"
    },
    {
      "title": "Happy Ninja",
      "product_id": "53",
      "quantity": "6"
    },
    {
      "title": "Ninja Silhouette",
      "product_id": "31",
      "quantity": "3"
    },
    {
      "title": "Woo Logo",
      "product_id": "15",
      "quantity": "3"
    },
    {
      "title": "Woo Album #1",
      "product_id": "83",
      "quantity": "3"
    },
    {
      "title": "Woo Album #4",
      "product_id": "96",
      "quantity": "1"
    },
    {
      "title": "Premium Quality",
      "product_id": "19",
      "quantity": "1"
    },
    {
      "title": "Ninja Silhouette",
      "product_id": "56",
      "quantity": "1"
    }
  ]
}

Webhooks

This section lists all API that can be used to create, edit or otherwise manipulate webhooks.

Webhooks Properties

Attribute Type Description
id integer The webhook ID (post ID) read-only
name string A friendly name for the webhook, defaults to “Webhook created on <date>”
status string Webhook status, options are active (delivers payload), paused (does not deliver), or disabled (does not deliver due delivery failures). Default is active
topic string Webhook topic, e.g. coupon.updated. See the complete list
resource string Webhook resource, e.g. coupon read-only
event string Webhook event, e.g. updated read-only
hooks array WooCommerce action names associated with the webhook read-only
delivery_url string The URL where the webhook payload is delivered
secret string Secret key used to generate a hash of the delivered webhook and provided in the request headers. required write-only
created_at string UTC DateTime when the webhook was created read-only
updated_at string UTC DateTime when the webhook was last updated read-only

Delivery Properties

Attribute Type Description
id integer The delivery ID (comment ID)
duration string The delivery duration, in seconds
summary string A friendly summary of the response including the HTTP response code, message, and body
request_url string The URL where the webhook was delivered
request_headers array Array of request headers (see Request Headers Attributes)
request_body string The request body, this matches the API response for the given resource (e.g. for the coupon.updated topic, the request body would match the response for GET /coupons/{id})
response_code string The HTTP response code from the receiving server
response_message string The HTTP response message from the receiving server
response_headers array Array of the response headers from the receiving server
response_body string The response body from the receiving server
created_at string A DateTime of when the delivery was logged

Request Headers Properties

Attribute Type Description
User-Agent string The request user agent, defaults to “WooCommerce/{version} Hookshot (WordPress/{version})”
Content-Type string The request content-type, defaults to “application/json”
X-WC-Webhook-Topic string The webhook topic
X-WC-Webhook-Resource string The webhook resource
X-WC-Webhook-Event string The webhook event
X-WC-Webhook-Signature string A base64 encoded HMAC-SHA256 hash of the payload
X-WC-Webhook-ID integer The webhook’s ID
X-WC-Webhook-Delivery-ID integer The delivery ID

Create A Webhook

This API helps you to create a new webhook.

HTTP Request

POST
/wc-api/v2/webhooks
curl -X POST https://example.com/wc-api/v2/webhooks \
    -u consumer_key:consumer_secret \
    -H "Content-Type: application/json" \
    -d '{
  "webhook": {
    "name": "An add to cart webhook",
    "secret": "my-super-secret-private-key",
    "topic": "action.woocommerce_add_to_cart",
    "delivery_url": "http://requestb.in/1exdwip1"
  }
}'
var data = {
  webhook: {
    name: 'An add to cart webhook',
    secret: 'my-super-secret-private-key',
    topic: 'action.woocommerce_add_to_cart',
    delivery_url: 'http://requestb.in/1exdwip1'
  }
};

WooCommerce.post('webhooks', data, function(err, data, res) {
  console.log(res);
});
data = {
    "webhook": {
        "name": "An add to cart webhook",
        "secret": "my-super-secret-private-key",
        "topic": "action.woocommerce_add_to_cart",
        "delivery_url": "http://requestb.in/1exdwip1"
    }
}

print(wcapi.post("webhooks", data).json())
<?php
$data = array(
    'webhook' => array(
        'name' => 'An add to cart webhook',
        'secret' => 'my-super-secret-private-key',
        'topic' => 'action.woocommerce_add_to_cart',
        'delivery_url' => 'http://requestb.in/1exdwip1'
    )
);

print_r($woocommerce->webhooks->create($data));
?>
data = {
  webhook: {
    name: "An add to cart webhook",
    secret: "my-super-secret-private-key",
    topic: "action.woocommerce_add_to_cart",
    delivery_url: "http://requestb.in/1exdwip1"
  }
}

woocommerce.post("webhooks", data).parsed_response

JSON response example:

{
  "webhook": {
    "id": 535,
    "name": "An add to cart webhook",
    "status": "active",
    "topic": "action.woocommerce_add_to_cart",
    "resource": "action",
    "event": "woocommerce_add_to_cart",
    "hooks": [
      "woocommerce_add_to_cart"
    ],
    "delivery_url": "http://requestb.in/1exdwip1",
    "created_at": "2015-01-21T13:19:58Z",
    "updated_at": "2015-01-21T13:19:58Z"
  }
}

View A Webhook

This API lets you retrieve and view a specific webhook.

HTTP Request

GET
/wc-api/v2/webhooks/<id>
curl https://example.com/wc-api/v2/webhooks/535 \
    -u consumer_key:consumer_secret
WooCommerce.get('webhooks/535', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("webhooks/535").json())
<?php print_r($woocommerce->webhooks->get(535)); ?>
woocommerce.get("webhooks/535").parsed_response

JSON response example:

{
  "webhook": {
    "id": 535,
    "name": "An add to cart webhook",
    "status": "active",
    "topic": "action.woocommerce_add_to_cart",
    "resource": "action",
    "event": "woocommerce_add_to_cart",
    "hooks": [
      "woocommerce_add_to_cart"
    ],
    "delivery_url": "http://requestb.in/1exdwip1",
    "created_at": "2015-01-21T13:19:58Z",
    "updated_at": "2015-01-21T13:19:58Z"
  }
}

View List Of Webhooks

This API helps you to view all the webhooks.

HTTP Request

GET
/wc-api/v2/webhooks
curl https://example.com/wc-api/v2/webhooks \
    -u consumer_key:consumer_secret
WooCommerce.get('webhooks', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("webhooks").json())
<?php print_r($woocommerce->webhooks->get()); ?>
woocommerce.get("webhooks").parsed_response

JSON response example:

{
  "webhooks": [
    {
      "id": 535,
      "name": "An add to cart webhook",
      "status": "active",
      "topic": "action.woocommerce_add_to_cart",
      "resource": "action",
      "event": "woocommerce_add_to_cart",
      "hooks": [
        "woocommerce_add_to_cart"
      ],
      "delivery_url": "http://requestb.in/1exdwip1",
      "created_at": "2015-01-21T13:19:58Z",
      "updated_at": "2015-01-21T13:19:58Z"
    },
    {
      "id": 313,
      "name": "Webhook created on Jan 17, 2015 @ 11:45 AM",
      "status": "active",
      "topic": "order.created",
      "resource": "order",
      "event": "created",
      "hooks": [
        "woocommerce_checkout_order_processed",
        "woocommerce_process_shop_order_meta",
        "woocommerce_api_create_order"
      ],
      "delivery_url": "http://requestb.in/1exdwip1",
      "created_at": "2014-12-17T11:45:05Z",
      "updated_at": "2015-01-10T00:41:08Z"
    }
  ]
}

Available Filters

Filter Type Description
status string Webhooks by status. The following options are available: active or paused and disabled. Default is active

Update A Webhook

This API lets you make changes to a webhook.

HTTP Request

PUT
/wc-api/v2/webhook/<id>
curl -X PUT https://example.com/wc-api/v2/webhook/535 \
    -u consumer_key:consumer_secret \
    -H "Content-Type: application/json" \
    -d '{
  "webhook": {
    "status": "paused"
  }
}'
var data = {
  webhook: {
    status: 'paused'
  }
}

WooCommerce.put('webhooks/535', data, function(err, data, res) {
  console.log(res);
});
data = {
    "webhook": {
        "status": "paused"
    }
}

print(wcapi.put("webhooks/535", data).json())
<?php
$data = array(
    'webhook' => array(
        'status' => 'paused'
    )
);

print_r($woocommerce->webhooks->updaste(535, $data));
?>
data = {
  webhook: {
    status: "paused"
  }
}

woocommerce.put("webhooks/535", data).parsed_response

JSON response example:

{
  "webhook": {
    "id": 535,
    "name": "An add to cart webhook",
    "status": "paused",
    "topic": "action.woocommerce_add_to_cart",
    "resource": "action",
    "event": "woocommerce_add_to_cart",
    "hooks": [
      "woocommerce_add_to_cart"
    ],
    "delivery_url": "http://requestb.in/1exdwip1",
    "created_at": "2015-01-21T13:19:58Z",
    "updated_at": "2015-01-21T13:19:58Z"
  }
}

Delete A Webhook

This API helps you delete a webhook.

HTTP Request

DELETE
/wc-api/v2/webhooks/<id>
curl -X DELETE https://example.com/wc-api/v2/webhooks/535 \
    -u consumer_key:consumer_secret
WooCommerce.delete('webhooks/535', function(err, data, res) {
  console.log(res);
});
print(wcapi.delete("webhooks/535").json())
<?php print_r($woocommerce->webhooks->delete(535)); ?>
woocommerce.delete("webhooks/535").parsed_response

JSON response example:

{
  "message": "Permanently deleted webhook"
}

View Webhooks Count

This API lets you retrieve a count of all webhooks.

HTTP Request

GET
/wc-api/v2/webhooks/count
curl https://example.com/wc-api/v2/webhooks/count \
    -u consumer_key:consumer_secret
WooCommerce.get('webhooks/count', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("webhooks/count").json())
<?php print_r($woocommerce->webhooks->get_count()); ?>
woocommerce.get("webhooks/count").parsed_response

JSON response example:

{
  "count": 4
}

Available Filters

Filter Type Description
status string Webhooks by status. The following options are available: active or paused and disabled

View A Webhooks Delivery

This API lets you retrieve and view a specific webhook delivery.

HTTP Request

GET
/wc-api/v2/webhooks/<id>/deliveries/<delivery_id>
curl https://example.com/wc-api/v2/webhooks/535/deliveries/378 \
    -u consumer_key:consumer_secret
WooCommerce.get('webhooks/535/deliveries/378', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("webhooks/535/deliveries/378").json())
<?php print_r($woocommerce->webhooks->get_deliveries(378)); ?>
woocommerce.get("webhooks/535/deliveries/378").parsed_response

JSON response example:

{
  "webhook_delivery": {
    "id": 378,
    "duration": "0.90226",
    "summary": "HTTP 200 OK: ok",
    "request_method": "POST",
    "request_url": "http://requestb.in/125q7ns1",
    "request_headers": {
      "User-Agent": "WooCommerce/2.3.0 Hookshot (WordPress/4.1)",
      "Content-Type": "application/json",
      "X-WC-Webhook-Topic": "action.woocommerce_add_to_cart",
      "X-WC-Webhook-Resource": "action",
      "X-WC-Webhook-Event": "woocommerce_add_to_cart",
      "X-WC-Webhook-Signature": "geC1akFhCtsO7fbXz5XiGUsMsRa4Mt0IJsZ96nTaHjI=",
      "X-WC-Webhook-ID": 535,
      "X-WC-Webhook-Delivery-ID": 378
    },
    "request_body": "{\"action\":\"woocommerce_add_to_cart\",\"arg\":\"7cbbc409ec990f19c78c75bd1e06f215\"}",
    "response_code": "200",
    "response_message": "OK",
    "response_headers": {
      "connection": "close",
      "server": "gunicorn/18.0",
      "date": "Wed, 21 Jan 2015 16:22:49 GMT",
      "content-type": "text/html; charset=utf-8",
      "content-length": "2",
      "sponsored-by": "https://www.runscope.com",
      "via": "1.1 vegur"
    },
    "response_body": "ok",
    "created_at": "2015-01-21T16:26:12Z"
  }
}

View List Of Webhooks Deliveries

This API helps you to view all deliveries from a specific webhooks.

HTTP Request

GET
/wc-api/v2/webhooks/<id>/deliveries
curl https://example.com/wc-api/v2/webhooks/535/deliveries \
    -u consumer_key:consumer_secret
WooCommerce.get('webhooks/535/deliveries', function(err, data, res) {
  console.log(res);
});
print(wcapi.get("webhooks/535/deliveries").json())
<?php print_r($woocommerce->webhooks->get_deliveries()); ?>
woocommerce.get("webhooks/535/deliveries").parsed_response

JSON response example:

{
  "webhook_deliveries": [
    {
      "id": 380,
      "duration": "0.58635",
      "summary": "HTTP 200 OK: ok",
      "request_method": "POST",
      "request_url": "http://requestb.in/125q7ns1",
      "request_headers": {
        "User-Agent": "WooCommerce/2.3.0 Hookshot (WordPress/4.1)",
        "Content-Type": "application/json",
        "X-WC-Webhook-Topic": "action.woocommerce_add_to_cart",
        "X-WC-Webhook-Resource": "action",
        "X-WC-Webhook-Event": "woocommerce_add_to_cart",
        "X-WC-Webhook-Signature": "st4egVCTwG1JMfxmxe7MZYEuj9Y6Euge4SOTNfCUCWY=",
        "X-WC-Webhook-ID": 535,
        "X-WC-Webhook-Delivery-ID": 380
      },
      "request_body": "{\"action\":\"woocommerce_add_to_cart\",\"arg\":\"c16a5320fa475530d9583c34fd356ef5\"}",
      "response_code": "200",
      "response_message": "OK",
      "response_headers": {
        "connection": "close",
        "server": "gunicorn/18.0",
        "date": "Wed, 21 Jan 2015 16:23:05 GMT",
        "content-type": "text/html; charset=utf-8",
        "content-length": "2",
        "sponsored-by": "https://www.runscope.com",
        "via": "1.1 vegur"
      },
      "response_body": "ok",
      "created_at": "2015-01-21T16:26:28Z"
    },
    {
      "id": 378,
      "duration": "0.90226",
      "summary": "HTTP 200 OK: ok",
      "request_method": "POST",
      "request_url": "http://requestb.in/125q7ns1",
      "request_headers": {
        "User-Agent": "WooCommerce/2.3.0 Hookshot (WordPress/4.1)",
        "Content-Type": "application/json",
        "X-WC-Webhook-Topic": "action.woocommerce_add_to_cart",
        "X-WC-Webhook-Resource": "action",
        "X-WC-Webhook-Event": "woocommerce_add_to_cart",
        "X-WC-Webhook-Signature": "geC1akFhCtsO7fbXz5XiGUsMsRa4Mt0IJsZ96nTaHjI=",
        "X-WC-Webhook-ID": 535,
        "X-WC-Webhook-Delivery-ID": 378
      },
      "request_body": "{\"action\":\"woocommerce_add_to_cart\",\"arg\":\"7cbbc409ec990f19c78c75bd1e06f215\"}",
      "response_code": "200",
      "response_message": "OK",
      "response_headers": {
        "connection": "close",
        "server": "gunicorn/18.0",
        "date": "Wed, 21 Jan 2015 16:22:49 GMT",
        "content-type": "text/html; charset=utf-8",
        "content-length": "2",
        "sponsored-by": "https://www.runscope.com",
        "via": "1.1 vegur"
      },
      "response_body": "ok",
      "created_at": "2015-01-21T16:26:12Z"
    }
  ]
}
This documentation is for the WooCommerce API v2 which is now deprecated. Please use the latest REST API version.