1

I want to update sku using Rest API in magento 2 Call:

PUT /rest/V1/products/{sku}

Request:
{
"product": {
"sku": "modified.sku",
"name": "modified name"
}
}

Result: The name has changed, but the sku is the same. How can I change the product sku?

1
0

SKU is a unique key for products. It can't be changed via the API.

0

You can update the SKU using the below request format. Since there is a bug in magento which doesn't update the new values for some store views. You can use the below Request URL and Request JSON.

PUT: rest/all/V1/products/{sku}.

{
  "saveOptions": "true",
  "product": {
    "id": 1,
    "sku": "modified.sku",
    "name": "modified.name",
    "attribute_set_id": your_attribute_set_id,
    "price": 34,
    "status": 1,
    "visibility": 4,
    "type_id": "simple"
   }
 }
1
  • The key is to add "id" and "saveOptions". It doesn't work when "saveOptions" is not added but works even if it's set true or false! – palindrom Mar 5 at 6:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.