add option to enable paypal in checkout

This commit is contained in:
David Remer 2020-09-03 11:23:11 +03:00
parent aee579f01a
commit 116837eadb
2 changed files with 16 additions and 0 deletions

View file

@ -533,6 +533,18 @@ return array(
'requirements' => array(), 'requirements' => array(),
'gateway' => 'paypal', 'gateway' => 'paypal',
), ),
'button_enabled' => array(
'title' => __( 'Enable buttons on Checkout', 'paypal-for-woocommerce' ),
'type' => 'checkbox',
'label' => __( 'Enable on Checkout', 'paypal-for-woocommerce' ),
'default' => true,
'screens' => array(
State::STATE_PROGRESSIVE,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
'button_layout' => array( 'button_layout' => array(
'title' => __( 'Button Layout', 'paypal-for-woocommerce' ), 'title' => __( 'Button Layout', 'paypal-for-woocommerce' ),
'type' => 'select', 'type' => 'select',

View file

@ -73,6 +73,10 @@ class DisableGateways {
unset( $methods[ CreditCardGateway::ID ] ); unset( $methods[ CreditCardGateway::ID ] );
} }
if ( $this->settings->has('button_enabled') && ! $this->settings->get('button_enabled') && ! $this->session_handler->order()) {
unset( $methods[ PayPalGateway::ID] );
}
if ( ! $this->needs_to_disable_gateways() ) { if ( ! $this->needs_to_disable_gateways() ) {
return $methods; return $methods;
} }