0

I am using Magento Version 2.4.5, I want to specifically add the country_id (e.g. FR for France) in the order email template.

The variable with the Billing address only returns the full address block.

Is there a way to solve this?

Thanks

1 Answer 1

1

Please try with the following code.

{{var order.getShippingAddress().getCountry()}} //Get the country’s ID

{{var order.getShippingAddress().getCountryModel().getName()}} //Get the country’s full name

{{var order.getBillingAddress().getCountry()}} //Get the country’s ID
3
  • Hello, I tried the code. I don't get an error but I don't get an output either. Its just blank.
    – JkCasi
    Sep 27 at 6:10
  • @JkCasi I have updated my answer. Can you try first with the billing then the shipping address? Sep 27 at 6:30
  • I tried all three but none give me an output. When I use {{var formattedBillingAddress|raw}} then i get one.
    – JkCasi
    Sep 27 at 7:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.