Skip to content

Instantly share code, notes, and snippets.

@mrkaluzny
Last active December 7, 2022 17:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrkaluzny/d54e3356fc268dc659528973c72a70ee to your computer and use it in GitHub Desktop.
Save mrkaluzny/d54e3356fc268dc659528973c72a70ee to your computer and use it in GitHub Desktop.
Remove duplicate stock from WooCommerce
DELETE pm1
FROM wp_postmeta pm1,
wp_postmeta pm2
WHERE
pm1.meta_key = '_stock'
AND pm2.meta_key = '_stock'
AND pm1.post_id = pm2.post_id
AND pm1.meta_id < pm2.meta_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment