Change text in PI module depending on customers country.
Posted: Fri Jan 19, 2024 10:00 am
This is for use on 1.8.0.20
I altered the PI Price module to show a bit of text under the products price explaining to customers that our prices included 20% VAT. The problem now is that a customer from outside the UK has complained that VAT has been charged on his order. When he logged in the price changed as it should but the bit of text under the price stayed the same, so I need a way to change the text that shows depending on the customers country.
The module code is very simple as I am not a coder and only contains the following which is mainly the standard price module
I have found different suggestions online that suggest to use the customers browser language, but is this the best way or change it once the customer has logged in and up until then assume that they are a UK customer as the store is in the UK.
I don't understand how to use IF ELSE statements so need a bit of help with that and also how best to find the customers country.
I altered the PI Price module to show a bit of text under the products price explaining to customers that our prices included 20% VAT. The problem now is that a customer from outside the UK has complained that VAT has been charged on his order. When he logged in the price changed as it should but the bit of text under the price stayed the same, so I need a way to change the text that shows depending on the customers country.
The module code is very simple as I am not a coder and only contains the following which is mainly the standard price module
Code: Select all
<div class="col-sm-<?= $content_width ?> pi-price mt-0">
<h2 class="list-group-item d-flex justify-content-between align-items-center">
<?=$GLOBALS['product']->get('is_special')
? sprintf(PI_PRICE_DISPLAY_SPECIAL, $GLOBALS['product']->format(), $GLOBALS['product']->format('price'))
: sprintf(PI_PRICE_DISPLAY, $GLOBALS['product']->format())
?></h2>
<?php echo PI_PRICE_VAT_NOTICE_TEXT_UK; ?>
</div>I don't understand how to use IF ELSE statements so need a bit of help with that and also how best to find the customers country.