Check if product has weight before calculate weigth total in cart
Closes #19347
This commit is contained in:
parent
7aef2349bf
commit
768a21e788
|
@ -673,7 +673,9 @@ class WC_Cart extends WC_Legacy_Cart {
|
|||
$weight = 0;
|
||||
|
||||
foreach ( $this->get_cart() as $cart_item_key => $values ) {
|
||||
$weight += (float) $values['data']->get_weight() * $values['quantity'];
|
||||
if ( $values['data']->has_weight() ) {
|
||||
$weight += (float) $values['data']->get_weight() * $values['quantity'];
|
||||
}
|
||||
}
|
||||
|
||||
return apply_filters( 'woocommerce_cart_contents_weight', $weight );
|
||||
|
|
Loading…
Reference in New Issue