Fix view logic for Setup additional payment providers task (https://github.com/woocommerce/woocommerce-admin/pull/8391)

This commit is contained in:
Adrian Duffell 2022-03-01 17:06:20 +08:00 committed by GitHub
parent f306cc2ba5
commit f43e4caf4b
2 changed files with 16 additions and 1 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: Fix
Fix view logic for Setup additional payment providers task. #8391

View File

@ -37,8 +37,19 @@ class AdditionalPayments extends Payments {
* @return bool
*/
public function can_view() {
if ( ! Features::is_enabled( 'payment-gateway-suggestions' ) ) {
// Hide task if feature not enabled.
return false;
}
$woocommerce_payments = new WooCommercePayments();
return Features::is_enabled( 'payment-gateway-suggestions' ) && $woocommerce_payments->can_view();
if ( $woocommerce_payments->is_requested() && $woocommerce_payments->is_supported() && ! $woocommerce_payments->is_connected() ) {
// Hide task if WC Pay is installed via OBW, in supported country, but not connected.
return false;
}
return true;
}
}