WooCommerce PDF Invoice plugin is a good solution if you need to send an invoice to your customers in PDF format, along with the completed or processing order email.
But if you have multi-language web shop then you will face a problem when a customer makes an order using a language which is not like the one you use in the WordPress administration.
Yes, you might think that everything will work without the problems because you have translated the WC PDF Invoice plugin into all languages which are used in you web shop, and the WPML is all ready for customers to choose their language on front-end. But the problem will occur when you will mark the order as completed in you WP administration. Your customer will receive the PDF invoice written in the language which is used in the WP administration.
But the problem will occur when you will mark the order as completed in you WP administration. Your customer will receive the PDF invoice written in the language which is used in the WP administration.
There is a simple trick which can help you to overcome this issue. Because WooCommerce is such a great plugin and has so many useful filters and hooks, we can filter the URL which used for “order complete” button and append query to it.
The query which we will append to the URL is a key
lang, with a value
en for example. The value represents the language which customer has used while he created the order. This value is saved along with the order by the WPML plugin, as a post meta. To retrieve this value all you need to do is use
A full example of the code can be found here:
Please have in mind that this code will alter URL for “complete order” button only.