Overview of the Issue
When using Bookings and Appointments For WooCommerce Premium with WPML and WCML, it is not possible to add the same bookable product to the cart multiple times.
Attempting to do so results in the message:
“You cannot add another product name to your cart.”
Workaround
This issue is fixed in Bookings and Appointments For WooCommerce Premium 5.3.1. Updating solves it on your site, so you only need this workaround if you can’t update yet.
Please, make sure of having a full site backup of your site before proceeding.
- Add the following code to your theme’s functions.php file.
// WPML Workaround for compsupp-8226 add_filter( 'wcml_add_to_cart_sold_individually', function( $allow, $cart_item_data, $post_id, $qty ) { $product = wc_get_product( $post_id ); if ( $product && 'phive_booking' === $product->get_type() ) { return false; } return $allow; }, 10, 4 );