Created
October 5, 2020 07:52
-
-
Save vidishpurohit/d1e5a9c7e486ee108bfc5ee20ad9c589 to your computer and use it in GitHub Desktop.
Remove discount from variations and products woocommerce - WooExtend
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
<?php | |
require_once('wp-load.php'); | |
global $wpdb; | |
$str = "SELECT post_id, meta_value FROM {$wpdb->prefix}postmeta WHERE meta_key = '_regular_price'"; | |
$arrRes = $wpdb->get_results($str); | |
foreach ($arrRes as $key => $value) { | |
update_post_meta( $value->post_id, '_price', $value->meta_value); | |
echo $value->post_id . ' done<br/>'; | |
} | |
$str = "UPDATE {$wpdb->prefix}postmeta SET meta_value = '' WHERE meta_key IN ('_wpcd_sale_price', '_sale_price') "; | |
$arrRes = $wpdb->get_results($str); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment