I have added some fields to the order type and they are completed on checkout flow. I would like to include those fields in the confirmation email but I haven't found a way to get it on the twig template. I have followed this page to override twig email template.
For example, I have a field named as field_pedido_obs where the user could add some custom comments about the order. I have tried this on twig template:

{{ order_entity.field_pedido_obs}}
{{ order_entity.field_pedido_obs['#items'].0.value }}
{{ order_entity.field_pedido_obs['#items'].0.value }}
{{ order_entity.field_pedido_obs.value }}
{{ order_entity.field_pedido_obs[0].value }}
{{ order_entity.field_pedido_obs[0]|raw }}

But none of them works. How could I add it?

  • Because I didn't find a way to access this fields, at the end I added a preprocess function in a custom theme, that add this variable to the twig template.
    – briast
    Apr 15 at 11:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.