Call to member function is_type() on bool
-
The WooCommerce function
wc_get_productcan returnWC_Product|null|false. You have to be careful in your code to account for thenullorfalsecase – you can’t assume you have a product.For example, in your
ga.phpfile, you have:$product = wc_get_product( $product_id );
if (GATags()->getOption('woo_variable_as_simple') && $product->is_type('variation')) {
$product = wc_get_product($product->get_parent_id());
}
if(!$product) continue;You need to check that
$productis an actual product before you use$product->is_type('variation').Your plugin is currently breaking the checkout on several sites. Please check your code and update as soon as possible.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Call to member function is_type() on bool’ is closed to new replies.