[2.4] Fixed bulk edit sale_price when empty
This avoid sale_price saved as "0" and update correct update _price field, related issue: #8076 Closes #9437
This commit is contained in:
parent
ad29047d3c
commit
454ffa4677
|
@ -1344,13 +1344,11 @@ class WC_Admin_Post_Types {
|
|||
break;
|
||||
}
|
||||
|
||||
if ( ! empty( $new_price ) && $new_price != $old_sale_price ) {
|
||||
if ( isset( $new_price ) && $new_price != $old_sale_price ) {
|
||||
$price_changed = true;
|
||||
$new_price = round( $new_price, wc_get_price_decimals() );
|
||||
$new_price = ! empty( $new_price ) ? round( $new_price, wc_get_price_decimals() ) : '';
|
||||
update_post_meta( $post_id, '_sale_price', $new_price );
|
||||
$product->sale_price = $new_price;
|
||||
} else {
|
||||
update_post_meta( $post_id, '_sale_price', '' );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue