woocommerce_store_api_expose_error_details │ filter-hook │ WC 11.3.0

Filters whether unexpected Store API failures include the error message and exception class in the response.

Details are only ever sent to users who can manage WooCommerce; this filter cannot bypass that check. It defaults to WP_DEBUG so store staff can debug a production store without enabling debug mode site-wide.

Usage

add_filter( 'woocommerce_store_api_expose_error_details', 'wp_kama_woocommerce_store_api_expose_error_details_filter' );

/**
 * Function for `woocommerce_store_api_expose_error_details` filter-hook.
 * 
 * @param bool $expose_error_details Whether to include the error message and exception class.
 *
 * @return bool
 */
function wp_kama_woocommerce_store_api_expose_error_details_filter( $expose_error_details ){
	// filter...
	return $expose_error_details;
}
$expose_error_details(true|false)
Whether to include the error message and exception class.
Default: WP_DEBUG

Changelog

Since 11.3.0 Introduced.

Where the hook is called

UnexpectedErrorResponse::can_expose_details()
woocommerce_store_api_expose_error_details
woocommerce/src/StoreApi/Utilities/UnexpectedErrorResponse.php 95
$expose_error_details = (bool) apply_filters( 'woocommerce_store_api_expose_error_details', Constants::is_true( 'WP_DEBUG' ) );

Where the hook is used in WooCommerce

Usage not found.