Question

I am using PrestaShop 1.5.3.1 and I want to retrieve the Carrier ID during the Payment step in the checkout process.

In PrestaShop 1.4 I was using {$id_carrier} and it was working just fine, but it is not working in PrestaShop 1.5.x

I want to show one payment method depending on selected carrier.

For example:

{if $id_carrier == 1}
    my content
{/if} 
Was it helpful?

Solution

On the payment page, you can retrieve the selected Carrier ID using the following Smarty variable:

{$cart->id_carrier}

This will work anywhere in the Front-end, both on PrestaShop v1.4.x and v1.5.x.

{if isset($cart->id_carrier) && $cart->id_carrier == 1}
   {* Do some stuff here *}
{/if}

OTHER TIPS

$carrier = new Carrier($cart->id_carrier); // in payment module page

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top