0

I have two stores and want to set the "Use Default Value" option for the cost field when its value is empty. This is functioning correctly in the admin panel. How can I achieve this using the API with the following endpoint:

http://test.com/rest/en_UK/V1/products/sku? enter image description here

asked Oct 21, 2024 at 9:17

1 Answer 1

1

Here you just have to play with the scopes for this.

In this case, you need to call twice to the API, with different scopes. If you want an specific element on the storeview not defined at that scope, leave it blank and add the "use_default" property on true:

PUT http://test.com/rest/en_UK/V1/products/:sku
{
 "product": {
 "sku": "your-product-sku",
 "custom_attributes": [
 {
 "attribute_code": "cost",
 "value": "",
 "use_default": true
 }
 ]
 }
}
answered Oct 22, 2024 at 16:46
1
  • Thank you Serfe! Commented Oct 25, 2024 at 9:31

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.