woocommerce_store_api_disable_nonce_check хук-фильтрWC 1.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.

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

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.

Где вызывается хук

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

Где используется хук в WooCommerce

woocommerce/packages/woocommerce-blocks/src/BlockTypes/Checkout.php 376
add_filter( 'woocommerce_store_api_disable_nonce_check', '__return_true' );
woocommerce/packages/woocommerce-blocks/src/BlockTypes/Checkout.php 381
remove_filter( 'woocommerce_store_api_disable_nonce_check', '__return_true' );