WordPress at Your Fingertips
function is not described

WC_Cart::get_cart() public WC 1.0

Returns the contents of the cart in an array.

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

No Hooks.

Return

Array. contents of the cart

Usage

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

Code of WC_Cart::get_cart() WC 5.6.0

public function get_cart() {
	if ( ! did_action( 'wp_loaded' ) ) {
		wc_doing_it_wrong( __FUNCTION__, __( 'Get cart should not be called before the wp_loaded action.', 'woocommerce' ), '2.3' );
	}
	if ( ! did_action( 'woocommerce_load_cart_from_session' ) ) {
		$this->session->get_cart_from_session();
	}
	return array_filter( $this->get_cart_contents() );
}