Custom directive for email template not working as per Docs example (Magento 2.4.3-p2, 2.4.4)
Is there an existing issue for this?
- [x] I have searched the existing issues
Which topic?
https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/templates/template-email-migration.html#create-a-custom-directive
What's wrong with the content?
The example provided in the "Create a custom directive" section does not seem to work. I've tried with Magento 2.4.3-p2 as well as the newest 2.4.4. When I use the newly created directive ({{lifetime_spend}}) in an email template (ex. "New Order"), it is not interpreted, and shows as "{{lifetime_spend}}" in the email body.
Perhaps it's something else wrong on my side, but since I haven't been able to find a working example on the Internet, and having received no answers to my question posted on stack exchange, I decided to post my issue here.
I'd be grateful for someone to either confirm if this is an issue with Magento, or direct me to correctly implement a custom directive.
What changes do you propose?
I was expecting the example code to work "out-of-the-box".
Anything else that can help to cover this?
No response
Hi @akislawek. Thank you for your report. To speed up processing of this issue, make sure that you provided sufficient information.
Add a comment to assign the issue: @magento I am working on this
- Join Magento Community Engineering Slack and ask your questions in #github channel.
I found your question on SE, and following up I ended up here. Can confirm, on Mage2.4.4, that dropping the underscore (replace lifetime_spend with lifetimespend) and re-running setup:di:compile did work for me. Along the way I also set the is_legacy in the database to 0, but I'm not sure that had any real influence.
Here to confirm @vandijkstef's statement. Open source v2.4.4-p4 Example from Create a custom directive not working until underscore _ is removed