Round price adjustments. Closes #3797.

This commit is contained in:
Mike Jolley 2013-09-23 16:22:25 +01:00
parent ef1d565f55
commit 7fb49c4b68
1 changed files with 2 additions and 0 deletions

View File

@ -812,6 +812,7 @@ class WC_Admin_CPT_Product extends WC_Admin_CPT {
if ( isset( $new_price ) && $new_price != $old_regular_price ) { if ( isset( $new_price ) && $new_price != $old_regular_price ) {
$price_changed = true; $price_changed = true;
$new_price = number_format( $new_price, absint( get_option( 'woocommerce_price_num_decimals' ) ), '.', '' );
update_post_meta( $post_id, '_regular_price', $new_price ); update_post_meta( $post_id, '_regular_price', $new_price );
$product->regular_price = $new_price; $product->regular_price = $new_price;
} }
@ -854,6 +855,7 @@ class WC_Admin_CPT_Product extends WC_Admin_CPT {
if ( isset( $new_price ) && $new_price != $old_sale_price ) { if ( isset( $new_price ) && $new_price != $old_sale_price ) {
$price_changed = true; $price_changed = true;
$new_price = number_format( $new_price, absint( get_option( 'woocommerce_price_num_decimals' ) ), '.', '' );
update_post_meta( $post_id, '_sale_price', $new_price ); update_post_meta( $post_id, '_sale_price', $new_price );
$product->sale_price = $new_price; $product->sale_price = $new_price;
} }