Fix type safety issues in product price (#33926)
This commit is contained in:
parent
4ffd5992a9
commit
2e735ed5f7
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Add type safety while getting product price
|
|
@ -987,7 +987,7 @@ function wc_get_price_including_tax( $product, $args = array() ) {
|
|||
)
|
||||
);
|
||||
|
||||
$price = '' !== $args['price'] ? max( 0.0, (float) $args['price'] ) : $product->get_price();
|
||||
$price = '' !== $args['price'] ? max( 0.0, (float) $args['price'] ) : (float) $product->get_price();
|
||||
$qty = '' !== $args['qty'] ? max( 0.0, (float) $args['qty'] ) : 1;
|
||||
|
||||
if ( '' === $price ) {
|
||||
|
@ -1071,7 +1071,7 @@ function wc_get_price_excluding_tax( $product, $args = array() ) {
|
|||
)
|
||||
);
|
||||
|
||||
$price = '' !== $args['price'] ? max( 0.0, (float) $args['price'] ) : $product->get_price();
|
||||
$price = '' !== $args['price'] ? max( 0.0, (float) $args['price'] ) : (float) $product->get_price();
|
||||
$qty = '' !== $args['qty'] ? max( 0.0, (float) $args['qty'] ) : 1;
|
||||
|
||||
if ( '' === $price ) {
|
||||
|
|
Loading…
Reference in New Issue