Assume that I have customer_code in the sales_order_detail table. and I have created a view that store this column with increment_id.

How can I query that column into an email template by using increment_id?

I have called "var order.increment_id |raw":"Order Id" into template. but I don't know how to query the data in the template file.

1 Answer 1


Have you tried this https://magento.stackexchange.com/a/161053/77554

This might be needed to override the Magento/Sales/Model/Order.php

Please try your luck and let me know

Happy coding


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.