Get total weight of the cart in Magento2
Get total weight of the cart in Magento2
in order to get the total weight of the cart you can use two main methods, we will list them here
First Method
$weight = {getQuote()}
->getShippingAddress()
->getWeight();
Second method
$items = {getQuote()}->getAllItems(); $weight = 0; foreach($items as $item) { $weight += ($item->getWeight() * $item->getQty()) ; } echo $weight;