AJAX add to cart - theme not compatible with WC addons
Hi - I have a problem with BeTheme 25.1.7, Woocommerce 6.0 and Woocommerce Bookings 1.15.49.
We did an investigation with WC development Team and this is what we've got:
"This is most likely caused by a feature in your theme attempting to add the item to the cart via an AJAX action. The problem with the AJAX add to cart feature from the themes is that they are not coded to accept additional data that is on the product page, such as additional form fields provided for by product addons. I can see that you are using BeTheme, which as of version 25.x causes this incompatibility issue."
This is the error 500 content:
[29-Dec-2021 22:12:35 UTC] PHP Fatal error: Uncaught Error: Call to a member function is_type() on bool in /home/btycsfh/wp-content/plugins/woocommerce-bookings/includes/wc-bookings-functions.php:57
Stack trace:
#0 /home/btycsfh/wp-content/plugins/woocommerce-bookings/includes/class-wc-booking-cart-manager.php(77): is_wc_booking_product(false)
#1 /home/btycsfh/wp-includes/class-wp-hook.php(303): WC_Booking_Cart_Manager->validate_add_cart_item(true, 0, 1)
#2 /home/btycsfh/wp-includes/plugin.php(189): WP_Hook->apply_filters(true, Array)
#3 /home/btycsfh/wp-content/plugins/woocommerce/includes/class-wc-ajax.php(406): apply_filters('woocommerce_add...', true, 0, 1)
#4 /home/btycsfh/wp-includes/class-wp-hook.php(303): WC_AJAX::add_to_cart('')
#5 /home/btycsfh/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters('', Array)
#6 /home/btycsfh/wp-includes/plugin.php(470): WP_Hook->do_action(Array)
#7 /home/btycsfh/wp-admin/admin-ajax.php(187): do_action('wp_ajax_woocomm...')
# in /home/btycsfh/wp-content/plugins/woocommerce-bookings/includes/wc-bookings-functions.php on line 57
Error is not present when
WooCommerce > Settings > Products and uncheck Enable AJAX add to cart buttons on archives
feature is disabled.
Could you please investigate this issue? Thanks.
Comments
Seems to be related with this issue: https://wordpress.org/support/topic/betheme-25-x-no-longer-compatible-with-this-plugin-version-2-5-5/
Hello,
As you noticed in your message, some plugins require a page reload to send all information.
We do not support the plugin you mentioned, and if you want to use it, you should disable the AJAX option (you can check supported plugins here).
Before the version 25.0 AJAX option was not available for the single product in our theme, so before that update, the plugin worked because single products were reloaded.
Unfortunately, there is no other option than disabling AJAX in WooCommerce settings.
Best regards