Automattic\WooCommerce\Api\Infrastructure

Principal::can_use_debug_modepublicWC 1.0

Whether this principal may activate GraphQL debug mode on the endpoint.

Implementing can_use_debug_mode() is opt-in for plugin principal classes, a principal that doesn't define it is denied by default. Plugins building authenticated endpoints should make an explicit decision per principal model rather than inheriting a debug mode policy by accident.

Note that this method's outcome is necessary but not sufficient for debug mode to be active: the controller also requires the request to carry _debug=1. The decision can be overridden by the woocommerce_graphql_can_use_debug_mode

Method of the class: Principal{}

No Hooks.

Returns

null. Nothing (null).

Usage

$Principal = new Principal();
$Principal->can_use_debug_mode(): bool;

Principal::can_use_debug_mode() code WC 10.9.1

public function can_use_debug_mode(): bool {
	return user_can( $this->user, 'manage_options' );
}