cancel
Showing results for 
Search instead for 
Did you mean: 

Bulk Delete Products by SKU

SOLVED

Bulk Delete Products by SKU

Is there a way of bulk deleting products using the sku only?

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Bulk Delete Products by SKU

Hi @bikermanirl,

 

Maybe you can try to run this into your database:

 

DELETE FROM catalog_product_entity WHERE sku in (sku1, sku2, sku3, sku4, ...);

Please, rememeber to make a database backup before execute the scrtipt.

Also, after the scritp has finished you should reindex (use the bin/magento indexer:reindex)

View solution in original post

7 REPLIES 7

Re: Bulk Delete Products by SKU

Hi @bikermanirl,

 

Are you asking for a daily task or a one time solution?

Re: Bulk Delete Products by SKU

A one time solution. I need to remove a lot of products and manually searching for sku's would take too long.

Re: Bulk Delete Products by SKU

@bikermanirl Yes of course through script you can manage this stuff. btw do you already have list of sku's ? Or that also need to figure out ? 

-
Magento Programmer | Was my answer helpful? You can accept it as a solution.

Re: Bulk Delete Products by SKU

Thanks, I have the skus

 

Is there a script I can download to do that?

Re: Bulk Delete Products by SKU

Hi @bikermanirl,

 

Maybe you can try to run this into your database:

 

DELETE FROM catalog_product_entity WHERE sku in (sku1, sku2, sku3, sku4, ...);

Please, rememeber to make a database backup before execute the scrtipt.

Also, after the scritp has finished you should reindex (use the bin/magento indexer:reindex)

Re: Bulk Delete Products by SKU

I found this post while looking how to delete products. Are you sure this simple solution works? I know foreign keys will clean up a lot of it. but I also know a Magento golden rule is to use the models and not edit the db directly. Has anyone successfully ( or unsuccessfully) cleaned up products using this method?

 

Re: Bulk Delete Products by SKU

Doesn't this leave a lot of cruft in tables like catalog_product_entity_int, catalog_product_entity_decimal, etc. Plus all the images still take up space on the server, etc. Seems like, to do a thorough job, there should be a whole list of tables and folders to look through.