WordPress at Your Fingertips
function is not described

WC_Cart_Session::get_cart_for_session() public WC 1.0

Returns the contents of the cart in an array without the 'data' element.

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

No Hooks.


Array. contents of the cart


$WC_Cart_Session = new WC_Cart_Session();

Code of WC_Cart_Session::get_cart_for_session() WC 5.9.0

public function get_cart_for_session() {
	$cart_session = array();

	foreach ( $this->cart->get_cart() as $key => $values ) {
		$cart_session[ $key ] = $values;
		unset( $cart_session[ $key ]['data'] ); // Unset product object.

	return $cart_session;