3

I want to add an if or else statement to the invoice email template to check if the order shipping method is courier delivery order or self pick up order. How can I do this?

3

The conditonal syntax in email templates is the same as Magento 1.

Thus in your email template you can do stuff like this for example:

{{if logo_width}}
    width="{{var logo_width}}"
{{else}}
    width="200"
{{/if}}

You can find more information in the official documentation: http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/templates/template-email.html

  • 1
    How to check if logo_width > 250? – jafar pinjar Nov 15 '18 at 13:59
1

This is the same concept as magento 1,

Example:

{{if logo_width}}
    width="{{var logo_width}}"
{{else}}
    width="200"
{{/if}}

{{if logo_height}}
    height="{{var logo_height}}"
{{else}}
    height="100"
{{/if}}

Above example just demo purpose Check the width and height attributes of the img tag to reflect the area in which you want your logo to display (for example, 200 × 100).

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.