magento2: Email template displayed incorrectly when using depend inside an if
Preconditions and environment
- Magento version: 2.4.5-p1
- Magento version: 2.4.4-p2
Steps to reproduce
- Go to admin -> marketing -> email templates
- Click Add new email template
- Load Default Template form “New Order”
Add these lines before greeting/or wherever you want
{{if order_id}} {{depend order_id}} {{trans 'My order id is: <span class="no-link">%order_id</span>.' order_id=$order_id |raw}} {{/depend}} {{/if}}
So looks like this:
The if condition is not processed. I see that this in 2.4.5 (without p2) it is working. Probably the issue is in the filter function, which is in the vendor/magento/framework/Filter/Template.php file When i compare this with 2.4.5 version it way to different 2.4.5-p2
2.4.5
Expected resultif condition in email template processed correctly Actual resultif condition in email template not processed correctly Additional informationthis issue also happening on Magento 2.4.4-p2 Release noteNo response Triage and priority
About this issue
Most upvoted comments |



For anyone else who is getting this issue on 2.4.6-p3, this is a patch pulling in the lastest version of
vendor/magento/framework/Filter/Template.php(from2.4-develop) This may also work on other versions, but I haven’t tested.Reproducible in 2.4.6-p3 as well.
@nathanjosiah: I’m talking about the security fixes from 2.4.5-p1 (which already went GA more than a month ago), not upcoming ones from 2.4.6 😉 These really should get merged in 2.4-develop, otherwise new bugs introduced by them can’t be verified.
❌ You don’t have permission to export this issue.
Small update on this, the changes from AC-7093 are based on some security work that was done for the upcoming GA on March 14. For that reason, we cannot move the change to the public branches until the final release branches for 2.4.6 (which contain security fixes) are synced back into
2.4-develop. That means it will be at LEAST March 14 before we can move them but this process of synchronization usually takes a couple of weeks to finalize for every GA release.@hostep The ticket is AC-7093. It was merged but for some reason it was merged to private branches. I’m not sure why it was merged this way and I’m trying to find out.
That said, I’m not sure why this was closed by @engcom-Lima as “cannot reproduce”. This is a valid issue which has been escalated by a number of merchants. However, there is also workaround of just not using this specific combination. You can recreate the same templates by using a combination of
ifandelseinstead of depend.Hi @igi8819 ,
Thanks for your contribution and collaboration.
We have tried to reproduce the issue in latest 2.4-develop but issue is not reproducible. This issue will get fixed in upcoming version. Hence , closing this issue as not reproducible. Please feel free to reopen this ticket if you are facing any issue.
Thanks
@hostep None of the 2.4.6 security fixes will be merged back into
2.4-developuntil after 2.4.6 is GA in March’23.2.4.5-p1,2.4.4-p2and2.4.6all have their own scope and all security fixes are kept private until the release is GA.As for the issue being described here, we are taking a look at this issue via internal ticket AC-7093