Magento 2 delete Related and Cross sell products

In Magento 2 you can remove the Related Items and Cross Sell items from backend manually. But what is the best way when your have large number of products and want to delete related items or cross sell items for all at once?

While I searched for the solutions, I found many articles and developers are suggested to use CSV method and choose option “Replace” instead of “Add/Update”. But the problem with this options is Magento create the new product when we go with “Replace”, it’s actually not replacing the data with the CSV columns. It creating new products for each which is not good option at all. I spent 3-4 days for solutions and last I came to easy way is to do it directly from database. It’s working fine to my site and I got success to delete all Related Items and Cross Sell items from all site products.

First you have to find the link_id from catalog_product_link_type table.
In most case 1 for Related items, 4 for Up Sell items and 5 for Cross Sell items will be there but it’s better to check once.

Now, what you need is to delete all records from

catalog_product_link and
catalog_product_link_attribute_intwith a matching
link_type_id<strong> </strong>you wish to delete.

Before run the below query to do it, I suggested to keep the backup of your database, so you can easily revert back your work, if in case any problem comes.

One Reply to “Magento 2 delete Related and Cross sell products”

Leave a Reply

Your email address will not be published. Required fields are marked *