Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
If you're experiencing issues where WPML creates duplicate bookings for each language when an order is placed using WooCommerce Booking, and these duplicates are then incorrectly synced to Google Calendar, causing multiple notifications and sync errors, we have a solution for you.
Solution:
1. Ensure you back up your site.
2. Navigate to the file at

wp-content/plugins/woocommerce-multilingual/compatibility/WcBookings/class-wcml-bookings.php

.
3. Modify the file by replacing the line at 1805 from:

&& in_array( $event->hook, [ 'wc-booking-reminder', 'wc-booking-complete' ], true )

to:

&& in_array( $event->hook, [ 'wc-booking-reminder', 'wc-booking-complete', 'woocommerce_admin_new_booking' ], true )

4. After making this change, try to reproduce the issue to see if it resolves the problem with duplicate emails.
For the Google Calendar issue, it has been escalated to our development team, and we will update you as soon as there is a resolution.

Please note that this solution might be outdated or not applicable to your specific case. We highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the issue persists, please open a new support ticket.

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.

Tagged: 

This topic contains 23 replies, has 2 voices.

Last updated by Osama Mersal 1 year, 10 months ago.

Assisted by: Osama Mersal.

Author Posts
November 23, 2022 at 8:00 pm #12522329

markC-59

Hello,

We have the following plugins setup on our WordPress website:

- WPML Multilingual CMS
- WPML String Translation
- WPML Media
- WooCommerce
- WooCommerce Bookings
- WooCommerce Multilingual & Multicurrency
- And other plugins.

PHP Memory Limit 1024 Mb
WP Memory Limit 1024 Mb
We have run tests on our back end, we have made sure all results in https://wpml.org/faq/checklist-before-opening-a-ticket-in-wpml-support/ and https://wpml.org/faq/opening-a-ticket-in-our-forum/ are satisfactory.

We have made these configurations to the front end and back end:

Front end Neve:
Running two languages; Danish and English (default)

Back end:
WooCommerce Booking is connected to Google Calendar to sync Bookings between these two platforms. We use all standard configurations, no custom coding applied. We have a custom plug installed, but it is not activated.

Issues we are facing:
- When an order is created on the front end, using the WooCommerce Booking, WPML creates duplicates of the booking for each language that is active on the front end. WPML does this to maintain consistency throughout the languages that are active on the front end, and this makes sense. However, WooCommerce Booking plugin then syncs that same event on Google Calendar to the order of the active languages.

Use case: The Front End (FE) has 4 active languages. FE User selects language 3 and places a booking. The booking makes it to the calendar in WooCommerce Booking in language 3 but then errors occur.

The admin receives a booking for each of the active languages (in this Use Case, 4 emails arrive)

The booking shows in one instance in Bookings - Calendar, but show up in all 4 language instances in the Google Calendar.

Then, if admin deletes the booking, the original language booking is removed in Bookings - Calendar but the 3 duplicate languages remain visible in Google Calendar, and must be removed manually.

As a workaround:

We tried disabling translation for "booking" custom post type from WPML settings, but WPML still creates duplicates.

Solution we are expecting:
- We want EPML to suppress duplicating bookings in the Google Calendar, and to stop sending multiple mails to admin.

Whatever languages Front End User places the order/booking in, we only want that booking to remain as it is and to show up through the system.

Said in a different way; “It is okay that WPML replicates bookings throughout languages on the Front End, but the back end should not inherit these replications.”

Can you check and answer following?
1) Why WPML is creating translation "booking" even after "booking" post type "translatable" is disabled in WPML settings?
2) If above is not working or not possible, We want to stop WPML create duplicate "booking" and keep the one which is created from front end on which user is visiting site. Is there a way around using hooks or custom solutions to achieve "Solution we are expecting" which is explained above?

Let me know if any further details are needed.

All the best
Mark

November 27, 2022 at 7:55 am #12540647

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

Thanks for contacting WPML forums support. I'll be glad to help you today.

First of all, sorry for the late reply due to a higher workload. I would need to look closely at your site, so I would need to request temporary access (WP-Admin and FTP)
– preferably to a test site where the problem has been replicated if possible –
in order to be of better help and check if some configurations might need to be changed.

Your next answer will be private, which means only you and I can access it.

❌ Please backup your database and website ❌

✙ I would need your permission to de-activate and re-activate the Plugins and the Theme and change configurations on the site. This is also a reason the backup is critical.

✙ I also need your permission to take a local copy of your site to debug the issue without affecting your live site.

Thanks for your patience and cooperation

Best regards,
Osama

November 27, 2022 at 11:30 am #12541101

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi Mark,

Thanks for the access details. I'll consult our 2nd tier supporters regarding this issue and update you as soon as I get their reply.

Best regards,
Osama

November 29, 2022 at 7:46 pm #12557661

markC-59

I see that your team are loading in test bookings.

Please note that I see

* multiple bookings in Google Cal, same booking at time, just all active languages
* that your test team is able to book times over an existing booking
* that your test team is able to book overlapping sessions with multiple resources

I don't wish to add to the mystery, I am just reporting what I see.

Please see attached screen dump

Clipboard01.jpg
November 30, 2022 at 6:07 am #12559831

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

Thanks for your update. I'll pass the info to our 2nd tier support team.

Thanks,
Osama

December 1, 2022 at 2:53 pm #12571611

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

1) Thanks for your patience. Could you please try the following steps?
1- Take a backup of your site
2- Edit the (wp-content/plugins/woocommerce-multilingual/compatibility/WcBookings/class-wcml-bookings.php) file
3- Replace the Line 1805

&& in_array( $event->hook, [ 'wc-booking-reminder', 'wc-booking-complete' ], true )

With

&& in_array( $event->hook, [ 'wc-booking-reminder', 'wc-booking-complete', 'woocommerce_admin_new_booking' ], true )

4- Try to reproduce the issue

Kindly let me know if the above steps fixed the email issue.

2) The Google Calendar issue has been escalated to our Dev team, and I'll update you as soon as I get their reply.

Best regards,
Osama

December 1, 2022 at 3:58 pm #12572749

markC-59

I have successfully done as you instructed with the code.
I then created an order in Danish.
I can report that the front end email went to the user in Danish.
I can also report that the back end email went to admin in English. No duplicate mail this time.
I checked the WooCommerce Booking calendar which saw the order correctly.
The Google Calendar did not sync the order, however. Just FYI.

Thanks!
Mark

December 1, 2022 at 4:02 pm #12572757

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi Mark,

Thanks for your confirmation. I'll update you regarding the Google Calendar issue as soon as I get an update from our dev team.

Thanks for your cooperation and patience.

Best regards,
Osama

December 2, 2022 at 12:25 pm #12578429

markC-59

I also see that the "Reminder" emails about a booking placed in DK language sadly come out in EN language to the front end user

December 2, 2022 at 12:30 pm #12578445

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

Please translate the email strings and check if the email will be sent in the correct language.

You can find the strings in the string translation. For example, please check this string. (hidden link)

Best regards,
Osama

December 2, 2022 at 7:05 pm #12580381

markC-59

Hey,

Yes your suggestion fixes that specific portion of the mail, however there are many other parts of the mail that still are not translated.

Mark

December 2, 2022 at 7:21 pm #12580517

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi Mark,

Please search for the untranslated strings in the String Translation to translate them. The string I shared is an example of how you can translate them.

Kindly check the following guides about string translation.

1) https://wpml.org/documentation/getting-started-guide/string-translation

2) https://wpml.org/documentation/getting-started-guide/string-translation/finding-strings-that-dont-appear-on-the-string-translation-page/

Best regards,
Osama

December 2, 2022 at 7:23 pm #12580529

markC-59

Yes, I will, but I see little point in doing this until we learn whether any rollbacks have to do be done

December 2, 2022 at 7:25 pm #12580531

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

So far, you can translate them to send reminders to the site's users in their booking language until our dev team checks the Google calendar issue.

Kind regards,
Osama

December 6, 2022 at 1:03 pm #12599261

markC-59

This process is taking a VERY long time, in fact, it feels unreasonable. What is the status currently?