Accessing cart->cart_contents directly :(
-
In includes/helpers.php you are accessing the cart contents directly instead of using the getter function of the class.
$cart_contents = $woocommerce->cart->cart_contents;
Besides being bad practice, this in effect bypasses the filter provided by WooCommerce ‘woocommerce_get_cart_contents’
A better and more developer-friendly method would be to use the getter
$cart_contents = $woocommerce->cart->get_cart();
- The topic ‘Accessing cart->cart_contents directly :(’ is closed to new replies.