0

What is the SQL query can i use in phpmyadmin to alter(update) the listed products cost in woocommerce.

EX: I want to add or subtract $100 from all the listed products.

1
  • that's not WP question specifically, you might ask that on Stackoverflow to get better help from DB/Mysql users.
    – T.Todua
    Commented Oct 1, 2018 at 7:19

1 Answer 1

0

You shouldn't use a SQL query. You can do this programatically.

$price = get_post_meta( $product_id, '_price');
$price += 100; // use -= 100 to subtract
update_post_meta($product_id, '_price', $price);
update_post_meta($product_id, '_regular_price', $price);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.