woocommerce_store_api_disable_nonce_check filter-hookWC 4.5.0

Filters the Store API nonce check.

This can be used to disable the nonce check when testing API endpoints via a REST API client.

Usage

add_filter( 'woocommerce_store_api_disable_nonce_check', 'wp_kama_woocommerce_store_api_disable_nonce_check_filter' );

/**
 * Function for `woocommerce_store_api_disable_nonce_check` filter-hook.
 * 
 * @param boolean $disable_nonce_check If true, nonce checks will be disabled.
 *
 * @return boolean
 */
function wp_kama_woocommerce_store_api_disable_nonce_check_filter( $disable_nonce_check ){

	// filter...
	return $disable_nonce_check;
}
$disable_nonce_check(true|false)
If true, nonce checks will be disabled.

Changelog

Since 4.5.0 Introduced.

Where the hook is called

AbstractCartRoute::check_nonce()
woocommerce_store_api_disable_nonce_check
woocommerce/src/StoreApi/Routes/V1/AbstractCartRoute.php 309
if ( apply_filters( 'woocommerce_store_api_disable_nonce_check', false ) ) {

Where the hook is used in WooCommerce

woocommerce/src/Blocks/Domain/Services/Hydration.php 58
add_filter( 'woocommerce_store_api_disable_nonce_check', [ $this, 'disable_nonce_check_callback' ] );
woocommerce/src/Blocks/Domain/Services/Hydration.php 73
remove_filter( 'woocommerce_store_api_disable_nonce_check', [ $this, 'disable_nonce_check_callback' ] );