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?
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
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).
-
3
-
@jafarpinjar I don't think you can use if/else condition to check values. However, you can call a custom Block inside your email template and put your logic in the custom Block as suggested by: magento.stackexchange.com/questions/161041/… – Mohammed Joraid Aug 19 at 6:45