Incompatibility with Woo Global Cart

July 10, 2019 4:42 pm

Hi,

We’re implementing this plugin alongside Woo Global Cart.

On lines 3970 and 3971 you have the following functionality:

if (WC()->cart) {
foreach (WC()->cart->get_cart() as $cart_item_key => $item) {

Woo Global Cart globalizes the cart system so that it can be used on any multisite function. This means that when you run this, it will also loop through products that are not registered to the current site.

Thus, when it’s used in the following context (lines 1020, 1028, etc.)

if ($product->is_type(‘booking’) && $product->get_duration_type() == ‘customer’) {

It throws the following error shutting the site down:

Uncaught Error: Call to a member function is_type() on boolean

It might be wise to do the following:

if (is_object($product = wc_get_product($prod_id)))

Published by 5 Comments

5 Replies

Leave a Reply

Your email address will not be published.