Added numberic check for Regular price

This commit is contained in:
Akshaya Rane 2023-04-19 12:19:07 +05:30
parent caf20d7989
commit 51805cd565
1 changed files with 1 additions and 1 deletions

View File

@ -985,7 +985,7 @@ class WC_Admin_Post_Types {
break; break;
} }
$regular_price = $product->get_regular_price(); $regular_price = $product->get_regular_price();
if ( $is_percentage ) { if ( $is_percentage && is_numeric( $regular_price ) ) {
$percent = $price / 100; $percent = $price / 100;
$new_price = max( 0, $regular_price - ( NumberUtil::round( $regular_price * $percent, wc_get_price_decimals() ) ) ); $new_price = max( 0, $regular_price - ( NumberUtil::round( $regular_price * $percent, wc_get_price_decimals() ) ) );
} else { } else {