Delete Duplicate Products by SKU in Wordpress Woocommerce Table

Valerie Criswell
Valerie Criswell used Ask the Experts™
on
I have duplicate SKUs in my Woocommerce Wordpress product table. There are plugins that delete duplicates by title, but I can't use those, as I need to preserve duplicate titles. How can I find and delete the newer record that has a duplicate SKU?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Hi,

depending where/how the sku is saved, is this a custom field or you use the one that come with the application?
the default  SKU is stored in postmeta table with meta_key _sku

You can try to edit the plugin for duplicated title and modify it to check for meta_key _sku

to find orphan you can use this
Dashboard > WooCommerce > Status > Tools tab
then click “delete orphaned variations” and “clear product transients”.

you can use this tool to optimize db
https://wordpress.org/plugins/wp-optimize/


*in any case do test on test DB and don't forget to make a full BD backup prior doing anything.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial