WC_Cart_Session::get_cart_for_session()
Returns the contents of the cart in an array without the 'data' element.
Method of the class: WC_Cart_Session{}
No Hooks.
Return
Array
. contents of the cart
Usage
$WC_Cart_Session = new WC_Cart_Session(); $WC_Cart_Session->get_cart_for_session();
WC_Cart_Session::get_cart_for_session() WC Cart Session::get cart for session code WC 9.2.3
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; }