Closed rngadam closed 2 years ago
This check seems to fix it:
function bookacti_wc_get_cart_items_bookings( $cart_items = array(), $filters = array() ) {
global $woocommerce;
if( ! $woocommerce->cart ) { return; }
Thank you for your report! This bug is fixed in the dev branch and will be released in the next update.
The final fix is:
function bookacti_wc_get_cart_items_bookings( $cart_items = array(), $filters = array() ) {
global $woocommerce;
if( ! $cart_items && ! empty( $woocommerce->cart ) ) { $cart_items = $woocommerce->cart->get_cart(); }
Thank you! We'll try the next update and report back.
Please, it's the same problem for this ?
Error: Call to a member function get_cart() on null in /Users/adlencherif/Local Sites/demo-wordpress/app/public/wp-content/plugins/booking-activities/f
unctions/functions-woocommerce.php on line 124
Yes, this is the same error.
You can replace wp-content/plugins/booking-activities/functions/functions-woocommerce.php line 124
if( ! $cart_items ) { $cart_items = $woocommerce->cart->get_cart(); }
with
if( ! $cart_items && ! empty( $woocommerce->cart ) ) { $cart_items = $woocommerce->cart->get_cart(); }
as a temporary fix.
wp_signon in the context of an API rest call from a third party webapp seems to fail because booking_activities tries to retrieve cart items and $woocommerce object has a null cart associated with it.
error log:
the corresponding code in booking-activities/functions/functions-woocommerce.php
Should there be a check here to make sure that $woocommerce has a non-null cart in this context?