WC_Cart::get_cart_contents()publicWC 3.2.0

Gets cart contents.

{} It's a method of the class: WC_Cart{}

Hooks from the method

Return

Array. of cart items

Usage

$WC_Cart = new WC_Cart();
$WC_Cart->get_cart_contents();

Changelog

Since 3.2.0 Introduced.

Code of WC_Cart::get_cart_contents() WC 6.6.1

public function get_cart_contents() {
	return apply_filters( 'woocommerce_get_cart_contents', (array) $this->cart_contents );
}