Skip to main content

Setting options

Setting option properties

AttributeTypeDescription
idstringA unique identifier for the setting. READ-ONLY
labelstringA human readable label for the setting used in interfaces. READ-ONLY
descriptionstringA human readable description for the setting used in interfaces. READ-ONLY
valuemixedSetting value.
defaultmixedDefault value for the setting. READ-ONLY
tipstringAdditional help text shown to the user about the setting. READ-ONLY
placeholderstringPlaceholder text to be displayed in text inputs. READ-ONLY
typestringType of setting. Options: text, email, number, color, password, textarea, select, multiselect, radio, image_width and checkbox. READ-ONLY
optionsobjectArray of options (key value pairs) for inputs such as select, multiselect, and radio buttons. READ-ONLY

Retrieve an setting option

This API lets you retrieve and view a specific setting option.

GET /wp-json/wc/v2/settings/<group_id>/<id>
curl https://example.com/wp-json/wc/v2/settings/general/woocommerce_allowed_countries \
-u consumer_key:consumer_secret

List all setting options

This API helps you to view all the setting options.

GET /wp-json/wc/v2/settings/<id>
curl https://example.com/wp-json/wc/v2/settings/general \
-u consumer_key:consumer_secret

Update a setting option

This API lets you make changes to a setting option.

PUT /wp-json/wc/v2/settings/<group_id>/<id>
curl -X PUT https://example.com/wp-json/wc/v2/settings/general/woocommerce_allowed_countries \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"value": "all_except"
}'

Batch update setting options

This API helps you to batch update multiple setting options.

note

Note: By default it's limited to up to 100 objects to be created, updated or deleted.

POST /wp-json/wc/v2/settings/<id>/batch
curl -X POST https://example.com/wp-json/wc/v2/settings/general/batch \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"update": [
{
"id": "woocommerce_allowed_countries",
"value": "all"
},
{
"id": "woocommerce_demo_store",
"value": "yes"
},
{
"id": "woocommerce_currency",
"value": "GBP"
}
]
}'