Everywhere where “WC()->cart->…” is called, there has to be a check if the cart is empty/null. For example:
if(!is_null(WC()->cart)) {
echo WC()->cart->get_cart_total();
echo WC()->cart->get_cart_contents_count();
} else {
echo ‘0’;
}
Everywhere where “WC()->cart->…” is called, there has to be a check if the cart is empty/null. For example:
if(!is_null(WC()->cart)) {
echo WC()->cart->get_cart_total();
echo WC()->cart->get_cart_contents_count();
} else {
echo '0';
}
-
This reply was modified 6 years, 5 months ago by webastronaut.