Skip to content Skip to sidebar

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 - -
- - - - - - -

Supporter timezone: Asia/Yerevan (GMT+04:00)

This topic contains 5 replies, has 2 voices.

Last updated by Christopher Amirian 1 year, 2 months ago.

Assisted by: Christopher Amirian.

Author Posts
May 14, 2024 at 10:51 am #15624820

mathiasB-21

Hi Support,

I have found an issue while printing invoice for orders. When I manually print the invoice it always give the product name in English for the first invoice even the complete template is in respective language (order received from the different language store)

image_2024_05_13T08_20_11_146Z.png
May 14, 2024 at 4:34 pm #15626518

Christopher Amirian
WPML Supporter since 07/2020

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

If by manual invoice sending you mean you go to WordPress Dashboard and do the sending from there then please consider whatever action is triggered from the WordPress Dashboard takes the dashboard language and not the front end language.

That is how WordPress works.

You can test by going to WordPress Dashboard > Users > Profile changing the profile language of your user to something else sending the invoice and seeing if it sends with that language.

If yes, then you can change the profile language to the language you want when you send the invoices manually.

Also, it is possible to add users with different languages in the dashboard, so you can log in with a user that you want that user language when sending the invoice.

Thank you.

May 15, 2024 at 7:10 am #15627899

mathiasB-21

Hi Christopher,

Thankyou for reply!
I understood your point but my concern is that when I'm printing the invoice only the first invoice is printing the product name in English and other invoices are prinitng in correct languages.

Basically we have multiple lanaguages store and the invoice is printed according to user's default language from which the order is received. so when we print the invoice even if the user's lanaguage is swedish then the invoice is printed in Swedish except the Product name. I tried to debug this issue but couldn't find any break-thru.

I hope I have made my words clear.
Thanks

May 15, 2024 at 2:57 pm #15631190

Christopher Amirian
WPML Supporter since 07/2020

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

I am not sure why this might happen. I wonder how can this be a checked and how I can troubleshoot that.

First of all I need to know what plugin we are talking about.

Is it a normal Woocomerce or a thrid party plugin as an addon?

I'd appreciate it if you could give me the URL/User/Pass of your WordPress dashboard after you make sure that you have a backup of your website.
It is absolutely important that you give us a guarantee that you have a backup so if something happens you will have a point of restore.

Make sure you set the next reply as private.

Also give us the steps to be able to check the issue so maybe we can find a solution.

Meanwhile, if it is a normal Woocomemrce one, please do the test below and get back to us with the result:

- IMPORTANT STEP! Create a backup of your website. Or better approach will be to test this on a copy/staging version of the website to avoid any disruption of a live website.
- Switch to the default theme such as "TwentyTwenty" by going to "WordPress Dashboard > Appearance > themes".
- Go to "WordPress Dashboard > Plugins" and deactivate all plugins except Woocommerce, WPML and WPML add-ons.
- Check if you can still recreate the issue.
- If not, re-activate your plugins one by one and check the issue each time to find out the plugin that causes the problem.

Thanks.

May 16, 2024 at 1:37 pm #15635436

mathiasB-21

Hi Christopher,

Basically, we have created a custom plugin for printing the invoices where we are printing multiple invoices in different languages altogether. Here the case is that the invoice needs to be printed in the language in which the user has placed the order.

I have mentioned below the code through which I have printed the invoice. Please check

$order_list = [101, 102, 103, 104, 105];

foreach ($order_list as $orderId) {

$order = new WC_Order( $orderId );

foreach( $order->get_items() as $item_id => $item ) {

$itemName = $item->get_name();

}
}

Here the $order_list contains the order IDs, which are in different languages.
We are using `WC_Order` class to get the order details and when I am getting the product name it will always be in English for the first invoice i.e 101 order. even if the 101 order is in any language, it always return the product name in English and second onward it is giving correct product information. Also if we place 101 on second position in that case it is giving in correct language.

May 18, 2024 at 11:46 am #15641772

Christopher Amirian
WPML Supporter since 07/2020

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

I am honestly not sure why this might happen.

Would you please test by adding a dummy number for the first entry and then in the loop skip the first one?

See if it works?

The topic ‘[Closed] Need help with Printing invoice’ is closed to new replies.