How to var_dump cart session in woocommerce?

Member

by orpha , in category: PHP CMS , 7 months ago

How to var_dump cart session in woocommerce?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by gilbert , 5 months ago

@orpha 

To var_dump the cart session in WooCommerce, you can use the following code snippet:

1
2
global $woocommerce;
var_dump($woocommerce->session->cart);


This code will output the contents of the cart session in WooCommerce, allowing you to see the products, quantities, and other relevant information stored in the session. You can add this code to your theme's functions.php file or to a custom plugin to view the cart session data.