Fix stripe being shown in Klarna and Square cases regardless of Stripe support
No difference in practice, since I believe all Klarna and Square countries are supported by Stripe, but for robustness this should be explicitly checked.
This commit is contained in:
parent
b26a3ca1a2
commit
b1b604b401
|
@ -1200,13 +1200,15 @@ class WC_Admin_Setup_Wizard {
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function get_wizard_in_cart_payment_gateways() {
|
protected function get_wizard_in_cart_payment_gateways() {
|
||||||
$country = WC()->countries->get_base_country();
|
|
||||||
$gateways = $this->get_wizard_available_in_cart_payment_gateways();
|
$gateways = $this->get_wizard_available_in_cart_payment_gateways();
|
||||||
|
|
||||||
if ( ! current_user_can( 'install_plugins' ) ) {
|
if ( ! current_user_can( 'install_plugins' ) ) {
|
||||||
return array( 'paypal' => $gateways['paypal'] );
|
return array( 'paypal' => $gateways['paypal'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$country = WC()->countries->get_base_country();
|
||||||
|
$can_stripe = $this->is_stripe_supported_country( $country );
|
||||||
|
|
||||||
if ( $this->is_klarna_checkout_supported_country( $country ) ) {
|
if ( $this->is_klarna_checkout_supported_country( $country ) ) {
|
||||||
$spotlight = 'klarna_checkout';
|
$spotlight = 'klarna_checkout';
|
||||||
} elseif ( $this->is_klarna_payments_supported_country( $country ) ) {
|
} elseif ( $this->is_klarna_payments_supported_country( $country ) ) {
|
||||||
|
@ -1216,15 +1218,18 @@ class WC_Admin_Setup_Wizard {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $spotlight ) ) {
|
if ( isset( $spotlight ) ) {
|
||||||
return array(
|
$offered_gateways = array(
|
||||||
$spotlight => $gateways[ $spotlight ],
|
$spotlight => $gateways[ $spotlight ],
|
||||||
'ppec_paypal' => $gateways['ppec_paypal'],
|
'ppec_paypal' => $gateways['ppec_paypal'],
|
||||||
'stripe' => $gateways['stripe'],
|
|
||||||
);
|
);
|
||||||
|
if ( $can_stripe ) {
|
||||||
|
$offered_gateways += array( 'stripe' => $gateways['stripe'] );
|
||||||
|
}
|
||||||
|
return $offered_gateways;
|
||||||
}
|
}
|
||||||
|
|
||||||
$offered_gateways = array();
|
$offered_gateways = array();
|
||||||
if ( $this->is_stripe_supported_country( $country ) ) {
|
if ( $can_stripe ) {
|
||||||
$gateways['stripe']['enabled'] = true;
|
$gateways['stripe']['enabled'] = true;
|
||||||
$gateways['stripe']['featured'] = true;
|
$gateways['stripe']['featured'] = true;
|
||||||
$offered_gateways += array( 'stripe' => $gateways['stripe'] );
|
$offered_gateways += array( 'stripe' => $gateways['stripe'] );
|
||||||
|
|
Loading…
Reference in New Issue