WooCommerce::is_request()privateWC 1.0

What type of request is this?

Method of the class: WooCommerce{}

No Hooks.

Return

true|false.

Usage

// private - for code of main (parent) class only
$result = $this->is_request( $type );
$type(string) (required)
admin, ajax, cron or frontend.

WooCommerce::is_request() code WC 8.6.1

private function is_request( $type ) {
	switch ( $type ) {
		case 'admin':
			return is_admin();
		case 'ajax':
			return defined( 'DOING_AJAX' );
		case 'cron':
			return defined( 'DOING_CRON' );
		case 'frontend':
			return ( ! is_admin() || defined( 'DOING_AJAX' ) ) && ! defined( 'DOING_CRON' ) && ! $this->is_rest_api_request();
	}
}