WooCommerce::is_store_api_request()publicWC 1.0

Returns true if the request is a store REST API request.

Method of the class: WooCommerce{}

No Hooks.

Return

true|false.

Usage

$WooCommerce = new WooCommerce();
$WooCommerce->is_store_api_request();

WooCommerce::is_store_api_request() code WC 9.2.3

public function is_store_api_request() {
	if ( empty( $_SERVER['REQUEST_URI'] ) ) {
		return false;
	}
	// phpcs:disable WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
	return false !== strpos( $_SERVER['REQUEST_URI'], trailingslashit( rest_get_url_prefix() ) . 'wc/store/' );
}