Invoice PDFs That Match Your Customer's Language
If you operate a multilingual Magento 2 store, chances are you have invested heavily in localising the frontend. But what about the documents your customers actually keep -- invoices?
By default, Magento does not print the invoice creation date on PDF invoices and does not translate PDF content based on the store view where the order was placed. This is more than a UX oversight: under EU law, it is a legal compliance gap.
Our Solution: PdfOverride Module
We built a custom Magento 2 module called PdfOverride that addresses these shortcomings:
- Adds Invoice Date and Order Date to the invoice header
- Translates all phrases using Magento's
i18n/*.csvstructure - Dynamically switches the locale based on the order's store view
- Provides a minimal override with maximum impact
Compatibility
- Magento 2.4.8 (tested)
- Works with multi-language, multi-store setups
Admin vs Customer Language
Previously, PDF output used the admin panel language regardless of which storefront the customer had used. With this module, the invoice language follows the store view the customer selected during checkout, correctly localising every field.
Why You Need This
- EU regulations require the invoice issue date on every invoice.
- Localised PDFs improve the customer experience and reduce tax and legal risks.
- The module is easy to maintain and built with Magento best practices.
Why Is the Invoice Date Required?
EU law (VAT Directive 2006/112/EC, Article 226) mandates that every invoice include:
- Invoice number
- Invoice issue date
- Date of supply (if different)
- Seller and buyer information
Missing the invoice date can lead to rejection during audits or B2B transactions.
Multi-Language Support
The module supports store-based translations. When a customer places an order in your German store view, the invoice is generated with German text -- not based on your admin user's language.
Example: German CSV Translation
"Order # ","Bestellnummer:"
"Invoice Date: ","Rechnungsdatum:"
"Order Date: ","Bestelldatum:"
"Sold to:","Rechnung an:"
"Ship to:","Lieferung an:"
"Payment Method:","Zahlungsart:"
"Shipping Method:","Versandart:"
"Total Shipping Charges","Versandkosten"
"Title","Sendungstitel"
"Number","Nummer"
"Invoice # ","Rechnung Nr. "
Save this file as:
app/code/Vendor/PdfOverride/i18n/de_DE.csv
Collect phrases automatically with:
bin/magento i18n:collect-phrases -o app/code/Vendor/PdfOverride/i18n/de_DE.csv app/code/Vendor/PdfOverride
How the Locale Is Determined
The PDF generation function uses Magento\Store\Model\App\Emulation to dynamically switch to the store's locale before rendering the PDF. This ensures the correct translation file is loaded based on the store where the order originated.
Installation Instructions
cd app/code
mkdir -p Vendor && cd Vendor
git clone https://github.com/privatedevops/scripts.git
mv scripts/magento2/modules/PdfOverride PdfOverride
bin/magento module:enable Vendor_PdfOverride
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:flush
Folder Structure
Vendor/PdfOverride/
├── etc/
│ ├── di.xml
│ └── module.xml
├── i18n/
│ └── de_DE.csv
├── Model/
│ └── Order/
│ └── Pdf/
│ └── Invoice.php
└── registration.php
License & Source
This module is open source under the MIT license. Contributions are welcome.
Final Thoughts
Complying with EU invoice regulations does not have to be complicated. This module gives your Magento store a professional, legally compliant, multilingual invoicing experience -- essential for modern eCommerce.
Need further customisations or support? Contact us at Private DevOps.
Need help with this?
Our team handles this kind of work daily. Let us take care of your infrastructure.
Related Articles
How to Boost Magento 2 Performance in a Few Easy Steps
Magento 2 delivers incredible flexibility for eCommerce, but without proper optimization it can become sluggish. This guide walks through ten proven DevOps strategies to dramatically speed up your store, from PHP upgrades and full-page caching to Varnish, Redis, CDN configuration, and ongoing code audits.
MagentoHow to Upgrade Magento 2 from 2.4.7 to 2.4.8
Keeping Magento current is critical for security, performance, and compatibility. This step-by-step guide walks developers through upgrading from Magento 2.4.7 to 2.4.8, covering system requirements, pre-upgrade checks, Git workflow, Composer commands, and post-upgrade validation.
MagentoHow to Completely Disable "Compare Products" in Magento 2
Magento's built-in Compare Products feature can add unnecessary clutter and slow down page loads. This guide shows you how to fully remove it using layout XML overrides, CSS rules, and a quick CLI deploy -- keeping your storefront clean and fast.