WC_Cart_Session::get_cart_for_session()
Returns the contents of the cart in an array without the ‘data’ element.
Description Description
Return Return
(array) contents of the cart
Source Source
File: includes/class-wc-cart-session.php
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;
}