Skip to content

Instantly share code, notes, and snippets.

@vidishpurohit
Created October 5, 2020 07:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vidishpurohit/d1e5a9c7e486ee108bfc5ee20ad9c589 to your computer and use it in GitHub Desktop.
Save vidishpurohit/d1e5a9c7e486ee108bfc5ee20ad9c589 to your computer and use it in GitHub Desktop.
Remove discount from variations and products woocommerce - WooExtend
<?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