Automattic\WooCommerce\Internal\Admin\Settings\PaymentProviders
WooPayments::is_in_test_mode
Try to determine if the payment gateway is in test mode.
This is a best-effort attempt, as there is no standard way to determine this. Trust the true value, but don't consider a false value as definitive.
Method of the class: WooPayments{}
No Hooks.
Returns
true|false
. True if the payment gateway is in test mode, false otherwise.
Usage
$WooPayments = new WooPayments(); $WooPayments->is_in_test_mode( $payment_gateway ): bool;
- $payment_gateway(WC_Payment_Gateway) (required)
- The payment gateway object.
WooPayments::is_in_test_mode() WooPayments::is in test mode code WC 9.8.5
public function is_in_test_mode( WC_Payment_Gateway $payment_gateway ): bool { if ( class_exists( '\WC_Payments' ) && is_callable( '\WC_Payments::mode' ) ) { $woopayments_mode = \WC_Payments::mode(); if ( is_callable( array( $woopayments_mode, 'is_test' ) ) ) { return $woopayments_mode->is_test(); } } return parent::is_in_test_mode( $payment_gateway ); }