Answer the question
In order to leave comments, you need to log in
WP WooCommerce how to get sum of sizes for products?
Need to get the sum of the sizes of all items in the cart, LxWxH
to loop through all the items? or is there a built in method?
I get the weight of all the goods in the cart like this WC()->cart->get_cart_contents_weight() , how to get the dimensions?
while doing this:
foreach($woocommerce->cart->get_cart() as $cart_item ){
$total_width += $cart_item['data']->get_width() * $cart_item['quantity'];
$total_height += $cart_item['data']->get_height() * $cart_item['quantity'];
$total_length += $cart_item['data']->get_length() * $cart_item['quantity'];
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question