WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Blocks\StoreApi\Routes

AbstractCartRoute::add_nonce_headers() protected WC 1.0

Add nonce headers to a response object.

{} It's a method of the class: AbstractCartRoute{}

No Hooks.

Return

\WP_REST_Response.

Usage

// protected - for code of main (parent) or child class
$result = $this->add_nonce_headers( $response );
$response(WP_REST_Response) (required)
The response object.

Code of AbstractCartRoute::add_nonce_headers() WC 5.8.0

protected function add_nonce_headers( \WP_REST_Response $response ) {
	$response->header( 'X-WC-Store-API-Nonce', wp_create_nonce( 'wc_store_api' ) );
	$response->header( 'X-WC-Store-API-Nonce-Timestamp', time() );
	$response->header( 'X-WC-Store-API-User', get_current_user_id() );
	return $response;
}