'Prestashop 1.7 , Hide Shipping Price (which always shows free) before the Shipping carrier step

Using Prestashop 1.7.6 I have a question regarding Free shipping, as you all know that it always shows Free (because it is selected by default in back office carriers) until it has been changed in carrier selection step.

so what I need guidance on is that I want to hide the shipping cost until "shipping method" step in check out. (or possibly if it says "To be calculated on next step" )

here is the cartpresenter.php code , which i guess shall need modifying ?

 

if (isset($deliveryOptionList) && count($deliveryOptionList) > 0) {
            foreach ($deliveryOptionList as $option) {
                foreach ($option as $currentCarrier) {
                    if (isset($currentCarrier['is_free']) && $currentCarrier['is_free'] > 0) {
                        $shippingDisplayValue = $this->translator->trans('Free', [], 'Shop.Theme.Checkout');
                        break 2;

Best Regards



Solution 1:[1]

You can create a theme and modify smarty templates :

For the cart

Copy to your theme and modify /themes/classic/templates/checkout/_partials/cart-detailed-totals.tpl and insert a condition at line 31 and close it at line 47:

<div class="card-block">
  {foreach from=$cart.subtotals item="subtotal"}
    {if $subtotal && $subtotal.value|count_characters > 0 && $subtotal.type !== 'tax'}
        {if $subtotal.type === 'shipping' && $subtotal.amount > 0} {* line added *}
        <div class="cart-summary-line" id="cart-subtotal-{$subtotal.type}">
          <span class="label{if 'products' === $subtotal.type} js-subtotal{/if}">
            {if 'products' == $subtotal.type}
              {$cart.summary_string}
            {else}
              {$subtotal.label}
            {/if}
          </span>
          <span class="value">
            {if 'discount' == $subtotal.type}-&nbsp;{/if}{$subtotal.value}
          </span>
          {if $subtotal.type === 'shipping'}
              <div><small class="value">{hook h='displayCheckoutSubtotalDetails' subtotal=$subtotal}</small></div>
          {/if}
        </div>
     {/if}  {* line added *}
    {/if}
  {/foreach}
</div>

For the checkout

Just do the same for file /themes/classic/templates/checkout/_partials/cart-summary-subtotals.tpl

Good luck :)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mystral