WC_Cart::get_cart() public WC 1.0
Returns the contents of the cart in an array.
{} Это метод класса: WC_Cart{}
Хуков нет.
Возвращает
Массив. contents of the cart
Использование
$WC_Cart = new WC_Cart(); $WC_Cart->get_cart();
Код WC_Cart::get_cart() WC Cart::get cart WC 5.0.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() );
}