WooCommerce::is_store_api_request()publicWC 1.0

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

Метод класса: WooCommerce{}

Хуков нет.

Возвращает

true|false.

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

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

Код WooCommerce::is_store_api_request() WC 9.8.1

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/' );
}