Created
July 5, 2023 17:43
-
-
Save lukecav/ef32fdbd50c0f2daf4de8db8a2491e37 to your computer and use it in GitHub Desktop.
Set all product inventory stock to zero in WooCommerce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE wp_postmeta pm | |
INNER JOIN wp_wc_product_meta_lookup pml | |
ON pm.post_id = pml.product_id | |
SET pm.meta_value = '0', pml.stock_quantity = '0' | |
WHERE pm.meta_key = '_stock'; | |
UPDATE wp_postmeta pm | |
INNER JOIN wp_wc_product_meta_lookup pml | |
ON pm.post_id = pml.product_id | |
SET pm.meta_value = 'outofstock', pml.stock_status = 'outofstock' | |
WHERE pm.meta_key = '_stock_status'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://stackoverflow.com/questions/76600551/resetting-all-woocommerce-products-stock-to-0