WC_Cart_Session::get_cart_for_session()publicWC 1.0

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

Метод класса: WC_Cart_Session{}

Хуков нет.

Возвращает

Массив. contents of the cart

Использование

$WC_Cart_Session = new WC_Cart_Session();
$WC_Cart_Session->get_cart_for_session();

Код WC_Cart_Session::get_cart_for_session() WC 8.7.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;
}