I have a multi-language store and I need to generate my invoice in 2 different languages in a PDF and the invoice email should also have both the languages. How can I do that.
1 Answer
If you want to have 2 languages in one Invoice PDF, you need to overwrite \Magento\Sales\Model\Order\Pdf\Invoice
and \Magento\Sales\Model\Order\Pdf\Items\Invoice\DefaultInvoice
and implement your custom rendering with your layout
If you want to customize email you can customize all sales_email_invoice_*
templates and customize sales_email_order_invoice_items
layout depends on your rules.
Maybe magento 2 how to translate strings to a specific locale will be helpful as well
One of alternative is generate Email/PDF content part for one locale and after for another one and glue parts
Invoice Templates [Added]
Magento uses 4 templates for invoice emails depends on scenario:
vendor/magento/module-sales/view/frontend/email/invoice_new.html
- email about new Invoice for customervendor/magento/module-sales/view/frontend/email/invoice_new_guest.html
- email about new Invoice for guestvendor/magento/module-sales/view/frontend/email/invoice_update.html
- email about update in Invoice for customervendor/magento/module-sales/view/frontend/email/invoice_update_guest.html
- email about update in Invoice for guest
If you want to customize it in you theme you should place copy of those files in app/design/frontend/<vendor>/<theme>/Magento_Sales/email/
If you want to customize templates per store you can use Marketing -> Email Templates feature. Create custom template for each store and specify it in Stores -> Configuration for your store scope
-
Can you specify which file to override for email content based on store id? Jun 8, 2022 at 10:55
-
-
Maybe you may help answer from Magento 2: Print invoice in multiple languages for the same store Jun 8, 2022 at 11:21