Atualizado em 21/10/2026
1
The coupons API allows you to create, view, update, and delete coupon codes.
| Attribute | Type | Description |
|---|---|---|
id |
integer | Unique identifier for the object. read-only |
code |
string | Coupon code. mandatory |
amount |
string | The amount of discount. Should always be numeric, even if setting a percentage. |
date_created |
date-time | The date the coupon was created, in the site's timezone. read-only |
date_created_gmt |
date-time | The date the coupon was created, as GMT. read-only |
date_modified |
date-time | The date the coupon was last modified, in the site's timezone. read-only |
date_modified_gmt |
date-time | The date the coupon was last modified, as GMT. read-only |
discount_type |
string | Determines the type of discount that will be applied. Options: percent, fixed_cart and fixed_product. Default is fixed_cart. |
description |
string | Coupon description. |
date_expires |
string | The date the coupon expires, in the site's timezone. |
date_expires_gmt |
string | The date the coupon expires, as GMT. |
usage_count |
integer | Number of times the coupon has been used already. read-only |
individual_use |
boolean | If true, the coupon can only be used individually. Other applied coupons will be removed from the cart. Default is false. |
product_ids |
array | List of product IDs the coupon can be used on. |
excluded_product_ids |
array | List of product IDs the coupon cannot be used on. |
usage_limit |
integer | How many times the coupon can be used in total. |
usage_limit_per_user |
integer | How many times the coupon can be used per customer. |
limit_usage_to_x_items |
integer | Max number of items in the cart the coupon can be applied to. |
free_shipping |
boolean | If true and if the free shipping method requires a coupon, this coupon will enable free shipping. Default is false. |
product_categories |
array | List of category IDs the coupon applies to. |
excluded_product_categories |
array | List of category IDs the coupon does not apply to. |
exclude_sale_items |
boolean | If true, this coupon will not be applied to items that have sale prices. Default is false. |
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. |
email_restrictions |
array | List of email addresses that can use this coupon. |
used_by |
array | List of user IDs (or guest email addresses) that have used the coupon. read-only |
meta_data |
array | Meta data. See Coupon - Meta data properties |
| Attribute | Type | Description |
|---|---|---|
id |
integer | Meta ID. read-only |
key |
string | Meta key. |
value |
string | Meta value. |
This API helps you to create a new coupon.
curl -X POST https://example.com/wp-json/wc/v3/coupons
-u consumer_key:consumer_secret
-H "Content-Type: application/json"
-d '{
"code": "10off",
"discount_type": "percent",
"amount": "10",
"individual_use": true,
"exclude_sale_items": true,
"minimum_amount": "100.00"
}'
JSON response example:
{ "id": 719, "code": "10off", "amount": "10.00", "date_created": "2017-03-21T15:23:00", "date_created_gmt": "2017-03-21T18:23:00", "date_modified": "2017-03-21T15:23:00", "date_modified_gmt": "2017-03-21T18:23:00", "discount_type": "percent", "description": "", "date_expires": null, "date_expires_gmt": null, "usage_count": 0, "individual_use": true, "product_ids": [], "excluded_product_ids": [], "usage_limit": null, "usage_limit_per_user": null, "limit_usage_to_x_items": null, "free_shipping": false, "product_categories": [], "excluded_product_categories": [], "exclude_sale_items": true, "minimum_amount": "100.00", "maximum_amount": "0.00", "email_restrictions": [], "used_by": [], "meta_data": [], "_links": { "self": [ { "href": "https://example.com/wp-json/wc/v3/coupons/719" } ], "collection": [ { "href": "https://example.com/wp-json/wc/v3/coupons" } ] } }
This API lets you retrieve and view a specific coupon by ID.
curl https://example.com/wp-json/wc/v3/coupons/719
-u consumer_key:consumer_secret
JSON response example:
{ "id": 719, "code": "10off", "amount": "10.00", "date_created": "2017-03-21T15:23:00", "date_created_gmt": "2017-03-21T18:23:00", "date_modified": "2017-03-21T15:23:00", "date_modified_gmt": "2017-03-21T18:23:00", "discount_type": "percent", "description": "", "date_expires": null, "date_expires_gmt": null, "usage_count": 0, "individual_use": true, "product_ids": [], "excluded_product_ids": [], "usage_limit": null, "usage_limit_per_user": null, "limit_usage_to_x_items": null, "free_shipping": false, "product_categories": [], "excluded_product_categories": [], "exclude_sale_items": true, "minimum_amount": "100.00", "maximum_amount": "0.00", "email_restrictions": [], "used_by": [], "meta_data": [], "_links": { "self": [ { "href": "https://example.com/wp-json/wc/v3/coupons/719" } ], "collection": [ { "href": "https://example.com/wp-json/wc/v3/coupons" } ] } }
This API helps you to list all the coupons that have been created.
curl https://example.com/wp-json/wc/v3/coupons
-u consumer_key:consumer_secret
JSON response example:
[ { "id": 720, "code": "free shipping", "amount": "0.00", "date_created": "2017-03-21T15:25:02", "date_created_gmt": "2017-03-21T18:25:02", "date_modified": "2017-03-21T15:25:02", "date_modified_gmt": "2017-03-21T18:25:02", "discount_type": "fixed_cart", "description": "", "date_expires": null, "date_expires_gmt": null, "usage_count": 0, "individual_use": true, "product_ids": [], "excluded_product_ids": [], "usage_limit": null, "usage_limit_per_user": null, "limit_usage_to_x_items": null, "free_shipping": true, "product_categories": [], "excluded_product_categories": [], "exclude_sale_items": false, "minimum_amount": "0.00", "maximum_amount": "0.00", "email_restrictions": [], "used_by": [], "meta_data": [], "_links": { "self": [ { "href": "https://example.com/wp-json/wc/v3/coupons/720" } ], "collection": [ { "href": "https://example.com/wp-json/wc/v3/coupons" } ] } }, { "id": 719, "code": "10off", "amount": "10.00", "date_created": "2017-03-21T15:23:00", "date_created_gmt": "2017-03-21T18:23:00", "date_modified": "2017-03-21T15:23:00", "date_modified_gmt": "2017-03-21T18:23:00", "discount_type": "percent", "description": "", "date_expires": null, "date_expires_gmt": null, "usage_count": 0, "individual_use": true, "product_ids": [], "excluded_product_ids": [], "usage_limit": null, "usage_limit_per_user": null, "limit_usage_to_x_items": null, "free_shipping": false, "product_categories": [], "excluded_product_categories": [], "exclude_sale_items": true, "minimum_amount": "100.00", "maximum_amount": "0.00", "email_restrictions": [], "used_by": [], "meta_data": [], "_links": { "self": [ { "href": "https://example.com/wp-json/wc/v3/coupons/719" } ], "collection": [ { "href": "https://example.com/wp-json/wc/v3/coupons" } ] } } ]
| Parameter | Type | Description |
|---|---|---|
context |
string | Scope under which the request is made; determines fields present in response. Options: view and edit. Default is view. |
page |
integer | Current page of the collection. Default is 1. |
per_page |
integer | Maximum number of items to be returned in result set. Default is 10. |
search |
string | Limit results to those matching a string. |
after |
string | Limit response to resources published after a given ISO8601 compliant date. |
before |
string | Limit response to resources published before a given ISO8601 compliant date. |
modified_after |
string | Limit response to resources modified after a given ISO8601 compliant date. |
modified_before |
string | Limit response to resources modified after a given ISO8601 compliant date. |
dates_are_gmt |
boolean | Whether to consider GMT post dates when limiting response by published or modified date. |
exclude |
array | Ensure result set excludes specific IDs. |
include |
array | Limit result set to specific ids. |
offset |
integer | Offset the result set by a specific number of items. |
order |
string | Order sort attribute ascending or descending. Options: asc and desc. Default is desc. |
orderby |
string | Sort collection by object attribute. Options: date, id, include, title and slug. Default is date. |
code |
string | Limit result set to resources with a specific code. |
This API lets you make changes to a coupon.
curl -X PUT https://example.com/wp-json/wc/v3/coupons/719
-u consumer_key:consumer_secret
-H "Content-Type: application/json"
-d '{
"amount": "5"
}'
JSON response example:
{ "id": 719, "code": "10off", "amount": "5.00", "date_created": "2017-03-21T15:23:00", "date_created_gmt": "2017-03-21T18:23:00", "date_modified": "2017-03-21T15:26:16", "date_modified_gmt": "2017-03-21T18:26:16", "discount_type": "percent", "description": "", "date_expires": null, "date_expires_gmt": null, "usage_count": 0, "individual_use": true, "product_ids": [], "excluded_product_ids": [], "usage_limit": null, "usage_limit_per_user": null, "limit_usage_to_x_items": null, "free_shipping": false, "product_categories": [], "excluded_product_categories": [], "exclude_sale_items": true, "minimum_amount": "100.00", "maximum_amount": "0.00", "email_restrictions": [], "used_by": [], "meta_data": [], "_links": { "self": [ { "href": "https://example.com/wp-json/wc/v3/coupons/719" } ], "collection": [ { "href": "https://example.com/wp-json/wc/v3/coupons" } ] } }
This API helps you delete a coupon.
curl -X DELETE https://example.com/wp-json/wc/v3/coupons/719?force=true -u consumer_key:consumer_secret
JSON response example:
{ "id": 719, "code": "10off", "amount": "5.00", "date_created": "2017-03-21T15:23:00", "date_created_gmt": "2017-03-21T18:23:00", "date_modified": "2017-03-21T15:26:16", "date_modified_gmt": "2017-03-21T18:26:16", "discount_type": "percent", "description": "", "date_expires": null, "date_expires_gmt": null, "usage_count": 0, "individual_use": true, "product_ids": [], "excluded_product_ids": [], "usage_limit": null, "usage_limit_per_user": null, "limit_usage_to_x_items": null, "free_shipping": false, "product_categories": [], "excluded_product_categories": [], "exclude_sale_items": true, "minimum_amount": "100.00", "maximum_amount": "0.00", "email_restrictions": [], "used_by": [], "meta_data": [], "_links": { "self": [ { "href": "https://example.com/wp-json/wc/v3/coupons/719" } ], "collection": [ { "href": "https://example.com/wp-json/wc/v3/coupons" } ] } }
| Parameter | Type | Description |
|---|---|---|
force |
string | Use true whether to permanently delete the coupon, Default is false. |