WC_Gateway_Paypal::should_loadpublicWC 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.

Method of the class: WC_Gateway_Paypal{}

No Hooks.

Returns

true|false. Whether PayPal Standard should be loaded.

Usage

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

Changelog

Since 5.5.0 Introduced.

WC_Gateway_Paypal::should_load() code WC 10.7.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;
}