Availability calculation for additional products is wrong when using WPML
See support thread here: https://bookingwp.com/forums/topic/maximum-inventory-quantity-for-the-same-staff-across-multiple-products/
It seems that the same product across two languages (different product id’s) show different availability WHEN ( this is the important part ) a translated product is added to cart. When the original language product is added to cart it works as it's designed.
Product A (language 1 – original post id) & Product A (language 2 – translated post id)
Steps to replicate:
CASE #1: Add Product A (language 2 – translated post id) to cart
==
Product A (language 1) : Availability = 2
Product A (language 1) : Availability = 2
RESULT: The correct availability
CASE #2: Add Product A (language 1 – original post id) to cart
Product A (language 1) : Availability = 2 Product A (language 1) : Availability = Unavailable RESULT: Incorrect availability
See VIDEO: https://drive.google.com/open?id=1glEuwHPKPd2N-JEZiZfzMNJxntVVkt1h
Comments (9)
-
-
I'll look into this with the upcoming update. Thanks for the report.
-
Hi. Additional testing also show issue with Memcache after removing appointment from cart in either language. The availability is restored only to the current language product id but the other language availability remains the same as before removing from cart. Clearing browser cache or dynamic cache didn't solve the issue, only by clearing memcache on server level reset the availability.
-
Tried to reproduce but it works without issues on my machine. If you disable all the caching, does the error still occur?
-
I'll send a follow-up to info@bookingwp.com.
-
@biznis86 I just checked with the latest version and the issue still remains. I've disabled all non-essential plugins and all custom code and the issue is still there. How can I help? What can we do to resolve this?
-
- changed status to resolved
Fixed with 4.3.0
-
Hi. Only one of several issues were resolved in version 4.3.1
RESOLVED ISSUE: * Adding original product to cart from original product id provides accurate Availability across products now. GREAT!
UNRESOLVED ISSUES: * Removing original product from cart ONLY deleted from $cart object but remains in Appointments as status=in-cart * Adding translated product to cart provides INACCURATE Availability for original product. =( -- See image for details from debugging using filter 'woocommerce_appointments_time_slot' from wc-appointments-functions.php::wc_appointments_get_time_slots()
Unfortunately the bug is only partially solved.
/Mattias
-
I think WPML somehow caches the cart across all translations. Can you check if this issue still occurs if all the caching is disabled? Check products in different browsers opened twice. For example open product A language A in one browser and product A language B in second browser. Do the same again but with both browsers in Private mode. I can't reproduce this on my localhost, where all the caching is disabled/forced.
I also added full access for you here, so you can check the code/commits and the whole build structure in detail. Hopefully, you can help us test it more and perhaps also add any improvements.
- Log in to comment
It's just me submitting this. /Mattias