0

In In Drupal 9 commerce_invoice I created a custom field for an invoice number with machine name 'field_numero_de_factura' and every time I generate a new invoice, I can manually enter the invoice number. The invoice number is shown correctly in /admin/commerce/orders/%/invoices . All this is working fine.

However I can't find out how to edit the commerce-invoice.html.twig template to print the value of the field_numero_de_factura in the invoice PDF.

I installed Twig Field Value and tried things like {{ invoice_entity.field_numero_de_factura|field_value }} or {{ content.invoice_entity.field_numero_de_factura|field_value }} in the commerce-invoice.html.twig template but no success.

Optionally it could be a custom order field instead of a custom comerce_invoice field. Any of the solutions would suit me.

Can anyone help me out? I guess more people are struggling with similar matters.

Thanks so much

1 Answer 1

0

I could achieve it using {{ invoice_entity.get('field_numero_de_factura').value }}.

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.