I have weird issue in Magento2

I sent a request via SOAP. And I have category id in this request.


  1. Save product.
  2. Delete product categories
  3. Add new category/categories

After that I see different categories in the product.

Product has correct category and also wrong other category.

How it possible?


  • Double-check that the category assignments for the product are being saved correctly and that there are no conflicting records in the database that could cause unexpected behavior.
    – Harun
    Jun 12 at 8:12
  • Thanks @Harun, I answered below.
    – Zalmoxis
    Jun 12 at 8:26

1 Answer 1



Thanks for your reply. I checked few days and I couldn't see anything. Because I am using database query for delete and add categories.

DELETE FROM `catalog_category_product` WHERE `product_id` = {$productId}

INSERT INTO `catalog_category_product` (`category_id`, `product_id`) VALUES ('{$category}', '{$productId}')

Can it be related indexers or something?

Also I cannot use categoryLinkManagement because it has bug for multiple webshop. It cannot delete categories in product.

  • it could be related to indexers
    – Harun
    Jun 12 at 9:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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