How can I restrict the country list to only display UK on the users step=address page and also change the Zipcode to Postcode?
Is that all done in the twig files
Thanks
How can I restrict the country list to only display UK on the users step=address page and also change the Zipcode to Postcode?
Is that all done in the twig files
Thanks
Hi Janice,
To change the field label from Zipcode to Postcode, you can edit that in the twig files.
Namely: billing-address-fields.twig
and shipping-address-fields.twig
located in theme/frontend/checkout/partial
.
For example of line 33 of shipping-address-fields.twig
, you could remove {{ lex('commerce.address.zip') }}
from the label tags and just type Postcode there. (or create your own lexicon if it needs to be multilingual)
Also, Mark just pointed out to me that it might be easier to find the value on the MODX Lexicons page (System -> Lexicons), that way you wouldn’t need to create a new one.
As for restricting to just the UK, probably the best way to do that is use the Country Validation
module.
You can add the country code to the Allowed Countries
field on the module config window.
This will restrict what countries are able to submit orders, and you can then change the templates to only display the UK in the dropdown.
There’s some good information about that here: https://docs.modmore.com/en/Commerce/v1/Modules/Address_Validation/Country.html