Skip Navigation

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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Europe/Madrid (GMT+01:00)

This topic contains 4 replies, has 1 voice.

Last updated by mykhailoK-8 1 day, 19 hours ago.

Assisted by: Marcel.

Author Posts
February 13, 2025 at 1:00 pm #16702148

mykhailoK-8

Background of the issue:
Hi! I had a problem on site https://wpml.org/forums/topic/instructions-to-payment-method-sent-in-incorrect-language/, this ticket was marked as resolved, but I have found the bug. I'm using wpml + woocommerce and custom integration with crm. It sends order on order creation
add_action( 'woocommerce_checkout_update_order_meta', function ( $order_id ) {
do_action( 'onebox_send_order', $order_id );
}, 9999 );
add_action( 'onebox_send_order', [ $this, 'send_order' ] );

public function send_order(
int $order_id, array $args = [
'customfields' => []
]
): void {
//handle data
$response = $this->send_request( 'order/set/', [ $order_data ], $order );

if ( isset( $response['dataArray'] ) ) {
$order->update_meta_data( 'onebox_id', $response['dataArray'][0] );
$order->save();
}
}

When the $order->save() is done, the language data dissapears. If I comment this row it works. As I understand, WPML somehow interfere when the order is saved by woocommerce. What is the correct way to fix the problem, so wpml language won't be erased. By missing language I mean that wpml_language meta is missing or has default language instead of secondary language. I'm using HPOS so it will be a problem to replace $order->save() with just update_post_meta

Symptoms:

Questions:

February 13, 2025 at 1:04 pm #16702292

mykhailoK-8

Symptoms: incorrect payment instructions language in email and incorrect language of products in email

February 18, 2025 at 5:39 pm #16720455

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+01:00)

Hi,

Thanks for the update! There is still an internal ticket open from your previous case, and we're currently investigating the issue to identify what might be causing it.

Best regards,
Marcel

February 20, 2025 at 12:44 pm #16729581

mykhailoK-8

Previous ticket was marked as resolved so I've opened a new one

February 20, 2025 at 1:12 pm #16729663

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+01:00)

Hi,

Yes, that’s fine. I was referring to an internal ticket in our bug tracker system, not the forum case itself. There was additional information from your previous case.

However, based on the information we have right now, we can only make an educated guess. It’s possible that $order->save() is being hooked or modified in our code due to a race condition—but this is just speculation at this point.

To properly debug this, we need a clear way to reproduce the issue. Could you please provide a Duplicator package of your site along with detailed instructions on how to trigger the order to your CRM to reproduce the issue?

Specifically, are there any particular steps involved in creating an order that lead to this behavior?

Thank you!

Best regards,
Marcel