How to get the cart contents from $woocommerce variable?

  • 0

if($woocommerce->cart->cart_contents != “”)
{
foreach( $woocommerce->cart->cart_contents as $keyoff => $book )
{
print_r($woocommerce->cart->cart_contents[$keyoff]);
print_r($book[‘quantity’]);

}
}

if($woocommerce->cart->cart_contents != “”) { foreach( $woocommerce->cart->cart_contents as $keyoff => $book ) { print_r($woocommerce->cart->cart_contents[$keyoff]); print_r($book[‘quantity’]); } }

if($woocommerce->cart->cart_contents != “”) { foreach( $woocommerce->cart->cart_contents as $keyoff => $book ) { print_r($woocommerce->cart->cart_contents[$keyoff]); print_r($book[‘quantity’]); } }