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 5:00 – 13:00 5:00 – 13:00 5:00 – 13:00 5: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: America/Argentina/Buenos_Aires (GMT-03:00)

Tagged: 

This topic contains 23 replies, has 1 voice.

Last updated by Otto 4 days, 14 hours ago.

Assisted by: Otto.

Author Posts
May 12, 2025 at 7:11 pm #17024400

Verbal

Background of the issue:
I am trying to resolve an issue similar to the one described in this forum post: https://wpml.org/forums/topic/duplicate-bookings-with-woocommerce-bookings/. I am using WooCommerce Multilingual & Multicurrency 5.4.5 with two languages: French as the default and English as the secondary. Bookings are created in both languages, and English booking posts have their post_meta set with _booking_duplicate_of=id_of_french_one and _language_code=en.

Symptoms:
All booking translations appear on the French side, creating duplicates and filling booking spots with duplicates. This prevents customers from booking slots that are artificially fully booked.
It appears translations aren't filtered out (on product pages and on Bookings/Calendar)

Questions:
Why are all booking translations appearing on the French side?
How can I prevent duplicate bookings from filling booking spots?

May 13, 2025 at 2:20 pm #17028443

Verbal

Hello,

While waiting for your team to take this ticket, I dug deeper in DB, and found the following.

We do not translate Booking products. They are classes given in one language: we do not want to display classes in French on the English side of the website (or worse, allow clients to book a class given a language they do not speak). This has been working properly for years now.

In the attached screenshot:
- the booking #94121 is translated but not duplicated
- the booking #96942 is duplicated (holds two slots on the product availability for this date, appears twice in the booking calendar on the French side)

Taking a look at meta_id 1261852, you can see that _booking_product_id has been set to the id of the French product (instead of being null as this product hasn't been translated to English/has no English version/product_id).

Setting the meta entry above to null fixes the issue for this booking.

My understanding:
- calendar display and slots' availability disregard the existence of _booking_duplicate_of and instead list all bookings having a French _booking_product_id
- a new version of Woocommerce Multilingual / Woocommerce bookings (release between fall 2024 and march 25th, 2025) now sets _booking_product_id to the product of the default language when no translated product exists and thus introduced this bug.

Can you help me find the source of this/share this with the Woocommerce Mutlilingual dev in charge of the Woocommerce Bookings Compatibility integration?

Regard,

Capture d’écran 2025-05-13 095628.png
May 14, 2025 at 10:59 am #17031769

Carlos Rojas
WPML Supporter since 03/2017

Languages: English (English ) Spanish (Español )

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

Thank you for contacting us.

Before one of my colleagues continue with this ticket I kindly ask you to check if the solution described in this ticket (that contains a similar problem) solves the issue on your site: https://wpml.org/forums/topic/multilingual-multicurrency-duplicates-bookings-in-woocommerce-bookings/

May 14, 2025 at 12:29 pm #17032186

Verbal

Hello Carlos,

https://wpml.org/forums/topic/multilingual-multicurrency-duplicates-bookings-in-woocommerce-bookings/ is unrelated (and not fixed, see page 2)

Can you please assign this ticket to a supporter/share this with the WooCommerce Multilingual dev in charge of the WooCommerce Bookings Compatibility integration?

May 15, 2025 at 1:23 pm #17037054

Otto
WPML Supporter since 09/2015

Languages: English (English ) Spanish (Español )

Timezone: America/Argentina/Buenos_Aires (GMT-03:00)

Hello,

I apologize for the delay in responding. I will take care of this ticket; the reply time will be shorter now.

There are two things here:
1. The booking post
2. The booking orders

When a user buys a booking, an order in each language is created. This is expected, and it is how the integration works. This allows for avoiding having two bookings (or one per language) on the same spot.

So, if this is what you are seeing, it's expected. If a user booked a spot in English, the same spot can't be booked in French.

If you want to have different booking posts in each language, you can create them per language and not link them as translations. If you already have bookings post-connected, you can disconnect them this way:
https://wpml.org/faq/how-to-disconnect-translations-from-the-default-language-page-or-post/

So, if a French booking post creates an order in English too, check if one is a translation of the other. If it is, disconnect them.

Best Regards,
Otto

May 15, 2025 at 2:54 pm #17037540

Verbal

Hello Otto,

This important to this case: our WooCommerce booking products aren't translated/not linked to a translation/do not need being disconnected.

The issue is that the translated bookings (the actual bookings, not the product), still get translated (with a _booking_duplicate_of post_meta created) but also get a _booking_product_id set to the original booking product (in the original language, French in my example).

This creates a duplicate booking on the French side (see example in the attached screenshot).
Even though _booking_duplicate_of is set to the original (French) booking id and _language_code is properly set to 'en', the English translation appears on the French calendar and blocks a spot.

My understanding is that, as no English booking product exists, the post_meta _booking_product_id for the English translation is erroneously set to the French booking id. This leads bot French and English booking posts to being counted as separate one and both appear on the French calendar.

So we loose two spots every time one is purchased / our classes are "fully booked" when half the spots have been sold.

Can you share this with the Woocommerce Mutlilingual dev in charge of the Woocommerce Bookings Compatibility integration?

Capture d’écran 2025-05-15 105234.png
May 15, 2025 at 5:30 pm #17038275

Otto
WPML Supporter since 09/2015

Languages: English (English ) Spanish (Español )

Timezone: America/Argentina/Buenos_Aires (GMT-03:00)

Hello,

I understand.

To escalate the issue, we first need to reproduce it from scratch.

I created a clean installation of WordPress, WooCommerce, WooCommerce Bookings, WPML, and all necessary WPML add-ons.
You can access the WordPress dashboard using the link below:
hidden link

Kindly follow the steps below:

- Don't restore your site there.
- Try to replicate the issue with minimal steps.
- Then let me know the steps to see the problem and reproduce it.

Best Regards,
Otto

May 26, 2025 at 12:56 pm #17073420

Verbal

Hello Otto,
The sandbox expired. Can you please reactivate it or send a new one?

May 26, 2025 at 5:01 pm #17074501

Otto
WPML Supporter since 09/2015

Languages: English (English ) Spanish (Español )

Timezone: America/Argentina/Buenos_Aires (GMT-03:00)

Hello,

I created a new sandbox, you can access the site here:
hidden link

Best Regards,
Otto

May 27, 2025 at 1:00 pm #17078540

Verbal

Hello Otto,

Done: you can see the bug in the sandbox.

Walkthrough:
- set French as default language in WPML
- created a bookable virtual product, with hourly blocks and max 2 bookings per block
- booked 1 block (may 30th at 12AM) and placed the order
- 2 duplicates appear in the calendar (3 bookings instead of one) and that block is now full instead of having one available block left

You can see the bug there (and in the attached screenshots):
1) The (single) booking appears 3 times in the calendar (as the sandbox was set with 3 languages).
hidden link

2) The (single) booking is counted as three: there's no more availability on May 30th at 12:00am (this slot is now hidden on the booking page)
hidden link

Here are three ways to fix this:
1) Easy&quick "revert back to the old way the WPML behaved": do not add _booking_product_id and _booking_resource_id post_meta pointing to the default language product and resource to translated bookings when the bookable product/resource is not translated
2) Logical one in continuity of the way WPML has been developing this intergration: Properly filter out translated bookings having _booking_duplicate_of post_meta when retrieving list of bookings in the calendar and in every availability check (would be good, but not my first choice as there are countless WooCommerce Bookings functions you'd have to double-check and properly hook to / will probably take ages and countless back-and-forth)
3) The best: simply do not translate bookings at all when the bookable product/resource has no translation (thus not creating useless bloat in the db and reducing the likelihood for bugs such as this one)

I currently have to "clean up" duplicates directly in db on a daily basis.

Can you please share this with the Woocommerce Mutlilingual dev in charge of the Woocommerce Bookings Compatibility integration and come back with an update?

Regards,

Screenshot 2025-05-27 at 08-37-39 Calendrier ‹ Sandbox — WordPress.png
Capture d’écran 2025-05-27 083850.png
May 27, 2025 at 3:14 pm #17079499

Otto
WPML Supporter since 09/2015

Languages: English (English ) Spanish (Español )

Timezone: America/Argentina/Buenos_Aires (GMT-03:00)

Hello,

Thank you very much for the testing and detailed explanation.

I escalated the issue to our second tier support. I'll get back to you as soon as I have news about the issue.

Best Regards,
Otto

June 5, 2025 at 1:07 pm #17110356

Verbal

Hello Otto,

What are the news? Can you share a patch we could apply before a new version is released?

Regards,

June 5, 2025 at 3:25 pm #17110992

Otto
WPML Supporter since 09/2015

Languages: English (English ) Spanish (Español )

Timezone: America/Argentina/Buenos_Aires (GMT-03:00)

Hello,

Our second tier support wasn't able to find a workaround. The issue is complex for a simple "hack". The problem is on our development team hands now. If there is a patch that you can try before the fix is released, I'll let you know.

Best Regards,
Otto

June 10, 2025 at 4:12 pm #17122850

Verbal

Hello Otto,

On a single day (with a sale, a class opening, several booking at the same date, etc), daily cleanups aren't enough and we're losing sales as classes are (incorrectly) marked as fully booked until manually adjusted in db.

WCML 3.4.9 is unaffected. This (serious) bug comes from the refactoring of the Bookings compatibility in higher version.

More specifically:
WcBookings.5.4.5\class-wcml-bookings.php
line 926: $trnsl_booking_product_id = $booking_product_id;
line 941: $trnsl_booking_resource_id = $booking_resource_id;

I understand the idea behind these changes, but proper filtering of bookings to return those only in the current language is then required (and missing).

1) Has it been assigned to a dev?
2) Is it currently being addressed or is still in backlog?
3) what's the current estimate for a fix?

Regards,

June 10, 2025 at 4:49 pm #17123048

Otto
WPML Supporter since 09/2015

Languages: English (English ) Spanish (Español )

Timezone: America/Argentina/Buenos_Aires (GMT-03:00)

Hello,

I am sorry for the inconveniences.

The issue is assigned to a developer. It's planned for WCML 5.5 (this may change though).

I requested for more information and asked if we can raise the priority of the issue.

I'll get back to you when I have a response.

Best Regards,
Otto