This article shows how you can programmatically assign a product to multiple categories and how you can remove a product from a category in Magento 2.
I am using a standalone script for this purpose using Object Manager. You can use this code in your custom module as well by using Dependency Injection (DI) instead of Object Manager.
Initialize Object Manager and Set the Area code
The following things are done in the below code:
– Initialize the object manager.
– Set the area code as adminhtml as we are editing the product.
– Define ...
Trending Articles
More Pages to Explore .....