Hello
I have added below code to check the order total is greater than 200 , but it is not working.
{{var order.getGrandTotal() |format=number}}
value is coming in above line.
{{if order.getGrandTotal() >= 200}}
Greater than or equal 200............
{{/if}}
{{if order.getGrandTotal() < 200}}
Less than 200............
{{/if}}
Can anyone give me solution .
Thank you in advance.
Solved! Go to Solution.
Hello @varshanema519b ,
If condition doesn't work that way in email template, you can add a custom block in email template like below :
{{block class='Magento\\Framework\\View\\Element\\Template' area='frontend' order=$order template='Vendor_Module::email/custom.phtml'}}Now, create a file app/code/Vendor/Module/view/frontend/email/custom.phtml
and add below code :
<?php
$order = $block->getOrder();
if($order->getGrandTotal() >= 200){
echo "Greater than or equal 200....";
}else{
echo "Less than 200....";
}
?>
Hello @varshanema519b ,
If condition doesn't work that way in email template, you can add a custom block in email template like below :
{{block class='Magento\\Framework\\View\\Element\\Template' area='frontend' order=$order template='Vendor_Module::email/custom.phtml'}}Now, create a file app/code/Vendor/Module/view/frontend/email/custom.phtml
and add below code :
<?php
$order = $block->getOrder();
if($order->getGrandTotal() >= 200){
echo "Greater than or equal 200....";
}else{
echo "Less than 200....";
}
?>