Functions are not needed when the gateway is disabled.

This commit is contained in:
Peter Fabian 2020-01-28 14:07:50 +01:00
parent dc9d4496e9
commit 8600987591
1 changed files with 5 additions and 2 deletions

View File

@ -68,11 +68,9 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway {
$this->description = trim( $this->description );
}
add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
add_action( 'woocommerce_order_status_processing', array( $this, 'capture_payment' ) );
add_action( 'woocommerce_order_status_completed', array( $this, 'capture_payment' ) );
add_filter( 'woocommerce_thankyou_order_received_text', array( $this, 'order_received_text' ), 10, 2 );
if ( ! $this->is_valid_for_use() ) {
$this->enabled = 'no';
@ -85,6 +83,11 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway {
new WC_Gateway_Paypal_PDT_Handler( $this->testmode, $this->identity_token );
}
}
if ( 'yes' === $this->enabled ) {
add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
add_filter( 'woocommerce_thankyou_order_received_text', array( $this, 'order_received_text' ), 10, 2 );
}
}
/**