From c53d6daed156d3c38d115234f804dd1662ca5382 Mon Sep 17 00:00:00 2001 From: Nestor Soriano Date: Tue, 14 Jul 2020 11:36:24 +0200 Subject: [PATCH] Fix error when `screen` not set in request, remove redundand `round`s. --- includes/admin/class-wc-admin-post-types.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/includes/admin/class-wc-admin-post-types.php b/includes/admin/class-wc-admin-post-types.php index 8698d4ed847..dc380f498ce 100644 --- a/includes/admin/class-wc-admin-post-types.php +++ b/includes/admin/class-wc-admin-post-types.php @@ -88,9 +88,8 @@ class WC_Admin_Post_Types { $screen_id = isset( $screen, $screen->id ) ? $screen->id : ''; } - $screen_data = $request_data['screen']; - if ( ! empty( $screen_data ) ) { - $screen_id = wc_clean( wp_unslash( $screen_data ) ); + if ( ! empty( $request_data['screen'] ) ) { + $screen_id = wc_clean( wp_unslash( $request_data['screen'] ) ); } switch ( $screen_id ) { @@ -936,7 +935,7 @@ class WC_Admin_Post_Types { case 2: if ( $is_percentage ) { $percent = $price / 100; - $new_price = $old_price + ( round( $old_price * $percent, wc_get_price_decimals() ) ); + $new_price = $old_price + ( $old_price * $percent ); } else { $new_price = $old_price + $price; } @@ -944,7 +943,7 @@ class WC_Admin_Post_Types { case 3: if ( $is_percentage ) { $percent = $price / 100; - $new_price = max( 0, $old_price - ( round( $old_price * $percent, wc_get_price_decimals() ) ) ); + $new_price = max( 0, $old_price - ( $old_price * $percent ) ); } else { $new_price = max( 0, $old_price - $price ); }