Jump to content

Custom information in checkout deppends from country PS.1.7


Andrejkov

Recommended Posts

Hello,

I need to add some modifications to my theme in checkout page. And i need to use "IF CODE", something like this:

{if CUSTOMER ADDRESS COUNTRY == 'UNITED KINGDOM'} DO SOMETHING {else} CODE {/if}

But I don't know what variable returns Customer address country. Does anyone know what variable to refer to in this condition?

Regards.

Link to comment
Share on other sites

Hello,
Please send some information about your Prestashop, which could help us to give you a more accurate response.
Can you please specify which Prestashop version you are using? 
Also, let us know if you are using the standard Prestashop checkout or a third-party checkout module.

Have a nice day, Leo.

Link to comment
Share on other sites

Create a new variable in OrderController.php by logging in and using the following code in the initContent() function:

$this->context->smarty->assign('country_variable', $country_variable);

Replace $country_variable with the name of the variable you want to create.

Once you have created and assigned the new variable, you can use it in the "themes/[your_theme]/checkout" directory. Open the checkout template and use the variable in your code like this:

{if $current_country == $country_variable}

        YOUR_PIECE_OF_CODE

{/if}

Replace $current_country with the name of the current country variable and YOUR_PIECE_OF_CODE with your own code.

By following these steps, you can easily modify the checkout page in PrestaShop to suit your needs.

 

  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...