Atualizado em 21/10/2026
1
The product attribute terms API allows you to create, view, update, and delete attribute terms.
| Attribute | Type | Description |
|---|---|---|
id |
integer | Unique identifier for the resource. read-only |
name |
string | Term name. mandatory |
slug |
string | An alphanumeric identifier for the resource unique to its type. |
description |
string | HTML description of the resource. |
menu_order |
integer | Menu order, used to custom sort the resource. |
count |
integer | Number of published products for the resource. read-only |
This API helps you to create a new product attribute term.
curl -X POST https://example.com/wp-json/wc/v3/products/attributes/2/terms
-u consumer_key:consumer_secret
-H "Content-Type: application/json"
-d '{
"name": "XXS"
}'
JSON response example:
{ "id": 23, "name": "XXS", "slug": "xxs", "description": "", "menu_order": 1, "count": 1, "_links": { "self": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes/2/terms/23" } ], "collection": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes/2/terms" } ] } }
This API lets you retrieve a product attribute term by ID.
curl https://example.com/wp-json/wc/v3/products/attributes/2/terms/23
-u consumer_key:consumer_secret
JSON response example:
{ "id": 23, "name": "XXS", "slug": "xxs", "description": "", "menu_order": 1, "count": 1, "_links": { "self": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes/2/terms/23" } ], "collection": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes/2/terms" } ] } }
This API lets you retrieve all terms from a product attribute.
curl https://example.com/wp-json/wc/v3/products/attributes/2/terms
-u consumer_key:consumer_secret
JSON response example:
[ { "id": 23, "name": "XXS", "slug": "xxs", "description": "", "menu_order": 1, "count": 1, "_links": { "self": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes/2/terms/23" } ], "collection": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes/2/terms" } ] } }, { "id": 22, "name": "XS", "slug": "xs", "description": "", "menu_order": 2, "count": 1, "_links": { "self": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes/2/terms/22" } ], "collection": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes/2/terms" } ] } }, { "id": 17, "name": "S", "slug": "s", "description": "", "menu_order": 3, "count": 1, "_links": { "self": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes/2/terms/17" } ], "collection": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes/2/terms" } ] } }, { "id": 18, "name": "M", "slug": "m", "description": "", "menu_order": 4, "count": 1, "_links": { "self": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes/2/terms/18" } ], "collection": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes/2/terms" } ] } }, { "id": 19, "name": "L", "slug": "l", "description": "", "menu_order": 5, "count": 1, "_links": { "self": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes/2/terms/19" } ], "collection": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes/2/terms" } ] } }, { "id": 20, "name": "XL", "slug": "xl", "description": "", "menu_order": 6, "count": 1, "_links": { "self": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes/2/terms/20" } ], "collection": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes/2/terms" } ] } }, { "id": 21, "name": "XXL", "slug": "xxl", "description": "", "menu_order": 7, "count": 1, "_links": { "self": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes/2/terms/21" } ], "collection": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes/2/terms" } ] } } ]
| 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. |
exclude |
array | Ensure result set excludes specific ids. |
include |
array | Limit result set to specific ids. |
order |
string | Order sort attribute ascending or descending. Options: asc and desc. Default is asc. |
orderby |
string | Sort collection by resource attribute. Options: id, include, name, slug, term_group, description and count. Default is name. |
hide_empty |
boolean | Whether to hide resources not assigned to any products. Default is false. |
parent |
integer | Limit result set to resources assigned to a specific parent. |
product |
integer | Limit result set to resources assigned to a specific product. |
slug |
string | Limit result set to resources with a specific slug. |
This API lets you make changes to a product attribute term.
curl -X PUT https://example.com/wp-json/wc/v3/products/attributes/2/terms/23
-u consumer_key:consumer_secret
-H "Content-Type: application/json"
-d '{
"name": "XXS"
}'
JSON response example:
{ "id": 23, "name": "XXS", "slug": "xxs", "description": "", "menu_order": 1, "count": 1, "_links": { "self": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes/2/terms/23" } ], "collection": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes/2/terms" } ] } }
This API helps you delete a product attribute term.
curl -X DELETE https://example.com/wp-json/wc/v3/products/attributes/2/terms/23?force=true -u consumer_key:consumer_secret
JSON response example:
{ "id": 23, "name": "XXS", "slug": "xxs", "description": "", "menu_order": 1, "count": 1, "_links": { "self": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes/2/terms/23" } ], "collection": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes/2/terms" } ] } }
| Parameter | Type | Description |
|---|---|---|
force |
string | Required to be true, as resource does not support trashing. |