HostOnNet Blog

How to show total weight on cart in Pretashop

Before modifiying template, you have to disable Cache in Admin area > Advanced parameters > Perfomance

STEP 1

Edit /src/Adapter/Presenter/Cart/CartPresenter.php

Find

  $productsTotalExcludingTax = $cart->getOrderTotal(false, Cart::ONLY_PRODUCTS);

Add after

$totalWeight = $cart->getTotalWeight();

Find (online 461)

 'labels' => $labels,

Add after

 'total_weight' => $totalWeight,

STEP 2

Edit /themes/yourtheme/templates/checkout/_partials/cart-summary-subtotals.tpl

Find (online 38)

{/foreach}

Add after

<div class="cart-summary-line" id="cart-subtotal-shipping">
    <label>{l s='Weight' d='Shop.Theme.Catalog'}</label>
    <span class="price">{$cart.total_weight|string_format:"%.2f"} {Configuration::get('PS_WEIGHT_UNIT')}</span>
</div>

Here is the final screenshot. We tested this on Pretashop 1.7.6.5


About Sibi Antony

Bootstrap and Android LOVER.I've been creating things for the web for over 10 years, from the period of flash and table based layout web sites till mobile and tab friendly web sites.
Posted in Wordpress