WC_Gateway_Paypal::should_load()
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{}
Хуки из метода
Возвращает
true|false
. 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 Gateway Paypal::should load WC 8.3.1
public function should_load() { $option_key = '_should_load'; $should_load = $this->get_option( $option_key ); if ( '' === $should_load ) { // New installs without PayPal Standard enabled don't load it. if ( 'no' === $this->enabled && WC_Install::is_new_install() ) { $should_load = false; } else { $should_load = true; } $this->update_option( $option_key, wc_bool_to_string( $should_load ) ); } else { $should_load = wc_string_to_bool( $should_load ); } /** * Allow third-parties to filter whether PayPal Standard should be loaded or not. * * @since 5.5.0 * * @param bool $should_load Whether PayPal Standard should be loaded. * @param WC_Gateway_Paypal $this The WC_Gateway_Paypal instance. */ return apply_filters( 'woocommerce_should_load_paypal_standard', $should_load, $this ); }