Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Queries for updating all prices including variations in WooCommerceIn this instance all prices are increased 2% #woocommerce #mysql
UPDATE wp_postmeta SET meta_value = Round(meta_value*1.02, 2) WHERE meta_key = '_regular_price' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = Round(meta_value*1.02, 2) WHERE meta_key = '_sale_price' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = Round(meta_value*1.02, 2)WHERE meta_key = '_price' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = Round(meta_value*1.02, 2) WHERE meta_key = '_regular_price_tmp' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = Round(meta_value*1.02, 2) WHERE meta_key = '_sale_price_tmp' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = Round(meta_value*1.02, 2) WHERE meta_key = '_price_tmp' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = Round(meta_value*1.02, 2) WHERE meta_key = '_min_variation_price' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = Round(meta_value*1.02, 2) WHERE meta_key = '_max_variation_price' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = Round(meta_value*1.02, 2) WHERE meta_key = '_min_variation_regular_price' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = Round(meta_value*1.02, 2) WHERE meta_key = '_max_variation_regular_price' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = Round(meta_value*1.02, 2) WHERE meta_key = '_min_variation_sale_price' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = Round(meta_value*1.02, 2) WHERE meta_key = '_max_variation_sale_price' AND meta_value != ''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment