Background of the issue:
I am trying to book an activity with a resource using WooCommerce Booking. The issue can be seen on this page: hidden link. I expected the resource count in the inventory to decrease correctly.
Symptoms:
The count of the resource in the inventory drops twice as much as expected, leading to incorrect resource booking.
Questions:
Why is the resource count in the inventory dropping twice?
How can I ensure the correct amount of resource is deducted from the inventory?
I understand you are seeing multiple duplicate bookings for the same booking on your site.
This duplication is occurring because it appears that WPML is handling the bookings differently than expected, resulting in duplication.
We have seen similar reports from other merchants and have advised contacting WPML, as the duplication is occurring from that plugin. WPML seems to duplicate the bookings into different languages which causes this issue. You can review the similar reports that are available on the WPML forum here:
Right now, as a workaround, I am running that query every minute :
DELETE wp_posts
FROM wp_posts
JOIN wp_postmeta ON wp_posts.ID = wp_postmeta.post_id
WHERE wp_posts.post_type = 'wc_booking'
AND wp_postmeta.meta_key = '_booking_duplicate_of'
We have a known issue with the WooCommerce Booking plugin and its “Max bookings per block” feature. Please check it at the following link and see if it is the same issue you are experiencing.
It is quite possible that the issue is related, but the problem is poorly described from a technical standpoint. It would be important to confirm whether the bookings are no longer available because WPML creates a duplicate, which has the effect of doubling the actual number of bookings. They can use the following query to check for duplicates:
SELECT wp_posts.ID
FROM wp_posts
JOIN wp_postmeta ON wp_posts.ID = wp_postmeta.post_id
WHERE wp_posts.post_type = 'wc_booking'
AND wp_postmeta.meta_key = '_booking_duplicate_of';
Our developers have fixed this issue, and the fix will be included in the next version of WooCommerce Multilingual & Multicurrency. We will update you here once this version is out.