Atualizado em 21/10/2026
1
The product attributes API allows you to create, view, update, and delete product attributes.
| Attribute | Type | Description |
|---|---|---|
id |
integer | Unique identifier for the resource. read-only |
name |
string | Attribute name. mandatory |
slug |
string | An alphanumeric identifier for the resource unique to its type. |
type |
string | Type of attribute. By default only select is supported. |
order_by |
string | Default sort order. Options: menu_order, name, name_num and id. Default is menu_order. |
has_archives |
boolean | Enable/Disable attribute archives. Default is false. |
This API helps you to create a new product attribute.
curl -X POST https://example.com/wp-json/wc/v3/products/attributes
-u consumer_key:consumer_secret
-H "Content-Type: application/json"
-d '{
"name": "Color",
"slug": "pa_color",
"type": "select",
"order_by": "menu_order",
"has_archives": true
}'
JSON response example:
{ "id": 1, "name": "Color", "slug": "pa_color", "type": "select", "order_by": "menu_order", "has_archives": true, "_links": { "self": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes/6" } ], "collection": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes" } ] } }
This API lets you retrieve and view a specific product attribute by ID.
curl https://example.com/wp-json/wc/v3/products/attributes/1
-u consumer_key:consumer_secret
JSON response example:
{ "id": 1, "name": "Color", "slug": "pa_color", "type": "select", "order_by": "menu_order", "has_archives": true, "_links": { "self": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes/6" } ], "collection": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes" } ] } }
This API helps you to view all the product attributes.
curl https://example.com/wp-json/wc/v3/products/attributes
-u consumer_key:consumer_secret
JSON response example:
[ { "id": 1, "name": "Color", "slug": "pa_color", "type": "select", "order_by": "menu_order", "has_archives": true, "_links": { "self": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes/6" } ], "collection": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes" } ] } }, { "id": 2, "name": "Size", "slug": "pa_size", "type": "select", "order_by": "menu_order", "has_archives": false, "_links": { "self": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes/2" } ], "collection": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes" } ] } } ]
| Parameter | Type | Description |
|---|---|---|
context |
string | Scope under which the request is made; determines fields present in response. Options: view and edit. Default is view. |
This API lets you make changes to a product attribute.
curl -X PUT https://example.com/wp-json/wc/v3/products/attributes/1
-u consumer_key:consumer_secret
-H "Content-Type: application/json"
-d '{
"order_by": "name"
}'
JSON response example:
{ "id": 1, "name": "Color", "slug": "pa_color", "type": "select", "order_by": "name", "has_archives": true, "_links": { "self": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes/6" } ], "collection": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes" } ] } }
This API helps you delete a product attribute.
<aside class="warning"> This also will delete all terms from the selected attribute. </aside>
curl -X DELETE https://example.com/wp-json/wc/v3/products/attributes/1?force=true -u consumer_key:consumer_secret
JSON response example:
{ "id": 1, "name": "Color", "slug": "pa_color", "type": "select", "order_by": "menu_order", "has_archives": true, "_links": { "self": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes/6" } ], "collection": [ { "href": "https://example.com/wp-json/wc/v3/products/attributes" } ] } }
| Parameter | Type | Description |
|---|---|---|
force |
string | Required to be true, as resource does not support trashing. |