Advertisement
meetsos

WooCommerce Increase Prices by Percentage with SQL

Jan 15th, 2020
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.41 KB | None | 0 0
  1. UPDATE `wp_postmeta`
  2. SET `meta_value` = ROUND(`meta_value` * 1.30, 2) --- for example 30%
  3. WHERE `meta_key` LIKE '%_price%'
  4. AND (meta_value > 0 OR `meta_value` != '')
  5. AND `post_id` IN (
  6.     SELECT `ID`
  7.     FROM `wp_posts`
  8.     WHERE `post_type` = 'product'
  9.     AND `post_status` = 'publish'
  10.     AND `post_date` LIKE '%2020-01-15%' --- for example only products I added on this date
  11.     AND `ID` = `post_id`
  12. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement