0

Updating a product with REST API with POST gives me a problem wenn I want to delete the category assignment

For example the product online is assignet into 3 categories and now I want it into 2 categories only.

So my POST would be like:

   {"product": {
        "id": 1234,
        "sku": "2345",
        "name": "Nice Product",
        "extension_attributes": {
            "website_ids": [1],
            "category_links": [{
                "position": 1,
                "category_id": "10"
            },
{
                "position": 2,
                "category_id": "11"
            }]
        }}
    }

But after this it still has assigment into 3 categories, its not deleeting the 3rd.

Btw. I have a simular question: Magento REST API Post Product and Category without "Sorting" parameter

0

I was not able to find any solution to Update the Category Entry within one POST. So the only solution was to delete them and in another POST to write the Update.

To delete Categorys Post this:

   {"product": {
        "id": 1234,
        "sku": "2345",
        "name": "Nice Product",
        "extension_attributes": {
            "website_ids": [1],
            "category_links": []
        }}
    }

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.