Automattic\WooCommerce\StoreApi

Authentication::get_cart_tokenprotectedWC 1.0

Gets the cart token from the request header.

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

Хуков нет.

Возвращает

Строку.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_cart_token( $request );
$request(WP_REST_Request) (обязательный)
The REST request instance.

Код Authentication::get_cart_token() WC 10.5.2

protected function get_cart_token( \WP_REST_Request $request ) {
	return wc_clean( wp_unslash( $request->get_header( 'Cart-Token' ) ?? '' ) );
}