Merge pull request #30493 from woocommerce/fix/30168-type-safety
Improve type safety (avoid trying to multiply a string by an int).
This commit is contained in:
commit
4523dfdacc
|
@ -226,7 +226,7 @@ final class WC_Cart_Totals {
|
|||
$item->taxable = 'taxable' === $cart_item['data']->get_tax_status();
|
||||
$item->price_includes_tax = wc_prices_include_tax();
|
||||
$item->quantity = $cart_item['quantity'];
|
||||
$item->price = wc_add_number_precision_deep( $cart_item['data']->get_price() * $cart_item['quantity'] );
|
||||
$item->price = wc_add_number_precision_deep( (float) $cart_item['data']->get_price() * (float) $cart_item['quantity'] );
|
||||
$item->product = $cart_item['data'];
|
||||
$item->tax_rates = $this->get_item_tax_rates( $item );
|
||||
$this->items[ $cart_item_key ] = $item;
|
||||
|
|
|
@ -84,7 +84,7 @@ class WC_Discounts {
|
|||
$item->object = $cart_item;
|
||||
$item->product = $cart_item['data'];
|
||||
$item->quantity = $cart_item['quantity'];
|
||||
$item->price = wc_add_number_precision_deep( $item->product->get_price() * $item->quantity );
|
||||
$item->price = wc_add_number_precision_deep( (float) $item->product->get_price() * (float) $item->quantity );
|
||||
$this->items[ $key ] = $item;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue