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
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 -
- 20:00 – 23:00 20:00 – 23:00 20:00 – 23:00 20:00 – 23:00 20:00 – 23:00 -

Supporter timezone: Asia/Singapore (GMT+08:00)

This topic contains 7 replies, has 2 voices.

Last updated by Kor 1 year, 9 months ago.

Assisted by: Kor.

Author Posts
July 10, 2024 at 1:43 pm

taimarP

Background of the issue:
I have a custom script which triggers with the hook woocommerce_order_status_processing in theme function file, when the order status is changed to processing. I noticed that order meta data is not saved to the database. A deeper investigation showed that the meta is stored but something deletes it, as add_post_meta returns the meta ID and if I look into the database, there is no such ID. I added die() right after add meta, then everything is okay. Even if I read the meta by ID with get_metadata_by_mid(), it returns the meta. But some other process interrupts and deletes my meta. Then I deactivated plugin by plugin and tested them. After disabling 'WPML Multilingual CMS', the meta is stored and stays in the DB. Site credentials are added into ticket #15899109.

Also i made little script which changes the order status so i can fast check when it works and when not.
I tried with order 415612

$order_id = 415612;
$order = wc_get_order( $order_id );
$order->update_status('wc-pending');
echo "Status: " . $order->get_status() ."";
echo "invoice_id_test: " . get_post_meta($order_id, 'invoice_id_test', true);

$order->update_status('wc-processing');
echo "Status: " . $order->get_status();
echo "invoice_id_test: " . get_post_meta($order_id, 'invoice_id_test', true);

Symptoms:
Order meta data is not saved to the database when the order status is changed to processing. The meta data is deleted by some process, which is identified to be related to the 'WPML Multilingual CMS' plugin.

Questions:
Why does the 'WPML Multilingual CMS' plugin delete the order meta data?
How can I prevent 'WPML Multilingual CMS' from deleting the order meta data?

July 10, 2024 at 2:15 pm #15928560

Kor

Thanks for your patience.

I can't see the issue while trying to replicate this for another order ID as shown in this screen recording hidden link . Is this the correct step to replicate it?

July 11, 2024 at 6:25 am #15932572

taimarP

strange that it worked on you.

the tag.php is just simulates the order status changes, nothing more.

I did now manually. see my video hidden link
1. checked is meta available - no
2. changed order to pending (ootab maksmist)
3. checked meta - no
4. changed order to processing (Töötluses) - now the hook should add meta to order, but no
5. turned off plugin "WPML Multilingual CMS"
6. changed order status to pending
7. checked meta -no (everything ok, so far there should not be them)
8. changed order to processing, now the hook should trigger and add meta, and it did

in debug.log is visible that system added two meta entries on both points 4 and 8, but somehow the meta created on point 4 disappear

[11-Jul-2024 06:07:13 UTC] WP order ID: 409682, invoice ID: 4444444
[11-Jul-2024 06:07:13 UTC] 123092275
[11-Jul-2024 06:07:13 UTC] 123092276
[11-Jul-2024 06:08:18 UTC] WP order ID: 409682, invoice ID: 4444444
[11-Jul-2024 06:08:18 UTC] 123092286
[11-Jul-2024 06:08:18 UTC] 123092287

wpml7.jpg
July 12, 2024 at 1:39 pm #15942849

Kor

Thank you for responding.

I noticed that the screen recording video wasn't functioning when I checked. However, I'd like to escalate this to our second-tier support. Could you replicate the issue on our sandbox site ? This would help demonstrate whether the issue is specific to your website or can be replicated elsewhere.

Login link hidden link

July 15, 2024 at 7:04 am #15952441

taimarP

please try now
hidden link

I will try to replicate error soon in your sandbox

July 15, 2024 at 4:04 pm #15955584

Kor

Thanks for your reply.

I can see the issue in the screen recording. Please try to replicate the issue on our sandbox site so that I can escalate this to our 2nd Tier Support for further investigation.

July 16, 2024 at 9:59 am #15959585

taimarP

cannot replicate there seems it works there fine, maybe wpml setting or some other plugin.
but on my site this is strange if I disable WPML, then it works.

hidden link

July 16, 2024 at 3:44 pm #15961412

Kor

Thank you for your response.

I believe a third-party plugin might be causing a conflict. Could you please deactivate all third-party plugins on your website and only activate the WC and WPML plugins? Afterward, please check to see if the issue is resolved.

The topic ‘[Closed] WPML and order processing hook’ is closed to new replies.