WooCommerce: remove empty SKU products

At work, we got ourselves a nice WooCommerce shop. Using WP All Import, it automagically imports the products and updates stock. But somehow in we ended up with products in our database with no SKU.

Removing one of those products, and then rerun the import, seemed to work. So maybe these products where in the product feed once without a SKU. Who knows. Anyways, I wanted them gone, and didn’t want to delete the entire database, afraid of what Google may think of that.

So I checked the database a bit and came up with a SQL query. First, to check if you have products with empty SKU’s as well, you could run something like this:

To remove the products, I think this should do. Of course this wouldn’t delete the files in your upload folder. If you want to delete those as well, you might want to write a script that selects the records, and then removes the images as well.


5 thoughts on “WooCommerce: remove empty SKU products

    • I don’t have a running WooCommerce anymore. But if I were you I’d first query the suplicate SKU’s. See how many you get. You could then also create a delete query from that, using the id’s with some creative copy & pasting.

  1. Pingback: Eliminar productos duplicados por SKU en Woocommerce - Kawaineko

Leave a Reply

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