woocommerce_store_api_disable_nonce_check
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
woocommerce_store_api_disable_nonce_check
woocommerce/src/StoreApi/Routes/V1/AbstractCartRoute.php 294
if ( apply_filters( 'woocommerce_store_api_disable_nonce_check', false ) ) {
Where the hook is used in WooCommerce
woocommerce/src/Blocks/Domain/Services/Hydration.php 235
add_filter( 'woocommerce_store_api_disable_nonce_check', array( $this, 'disable_nonce_check_callback' ) );
woocommerce/src/Blocks/Domain/Services/Hydration.php 250
remove_filter( 'woocommerce_store_api_disable_nonce_check', array( $this, 'disable_nonce_check_callback' ) );