WC_Gateway_Paypal::should_load │ public │ WC 5.5.0

Determines whether PayPal Standard should be loaded or not.

By default PayPal Standard isn't loaded on new installs or on existing sites which haven't set up the gateway.

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

Хуков нет.

Возвращает

bool. Whether PayPal Standard should be loaded.

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

$WC_Gateway_Paypal = new WC_Gateway_Paypal();
$WC_Gateway_Paypal->should_load();

Список изменений

С версии 5.5.0 Введена.

Код WC_Gateway_Paypal::should_load() WC 11.3.0

public function should_load() {
	$option_key  = '_should_load';
	$should_load = $this->get_option( $option_key );

	if ( '' === $should_load ) {
		// Set default `_should_load` to 'yes' on existing stores with PayPal Standard enabled or with existing PayPal Standard orders.
		$should_load = 'yes' === $this->enabled || $this->has_paypal_orders();

		$this->update_option( $option_key, wc_bool_to_string( $should_load ) );
	} else {
		// Enabled always takes precedence over the option.
		$should_load = wc_string_to_bool( $this->enabled ) || wc_string_to_bool( $should_load );
	}

	return $should_load;
}