Puddinq.com sharing knowledge

WooCommerce cart items -> get product information.

WooCommerce cart items -> get product information.

If you have the woocommerce object, it is easy to get the cart. If you have the cart, it is easy te get the product info. Here is how:


global $woocommerce;

$cart_items            = $woocommerce->cart->get_cart();

foreach ($cart_items as $cart_item_key => $cart_item) {

    $_product = apply_filters('woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key);

}