0

I have created custom order email template and placed some order shipping address variables inside it. Most variables work ok, but the following are always returning no value:

{{var order.getShippingAddress().getStreet1()}}
{{var order.getShippingAddress().getCountry()}}
{{var order.getShippingAddress().getCountryModel().getName()}}

Any ideas?

2 Answers 2

2

Try this instead :

{{var order.getShippingAddress().getStreetLine(1)}}
3
  • Thank you for the solution. Do you know about the country field too?
    – zekia
    Sep 14, 2019 at 7:17
  • Do you mean to say that you tried this and it's not working {{var order.getShippingAddress().getCountry()}}
    – Arif Ahmad
    Sep 15, 2019 at 10:07
  • please try this - {{var order.getShippingAddress().getCountryId()}} for getting the country code.
    – Arif Ahmad
    Sep 17, 2019 at 14:06
1

Please try with below way to check street deatils :

 {{var $order.getShippingAddress().getStreetLine(1) }}
 {{var $order.getShippingAddress().getStreetLine(2) }}

for more data if you want than check with below url.

https://hotexamples.com/examples/magento.sales.model.order/Address/getStreetLine/php-address-getstreetline-method-examples.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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