Simplify Payments task view logic
This commit is contained in:
parent
c82d8098e1
commit
fbd1464460
|
@ -76,13 +76,13 @@ class Payments extends Task {
|
|||
* @return bool
|
||||
*/
|
||||
public function can_view() {
|
||||
$woocommerce_payments = $this->task_list->get_task( 'woocommerce-payments' );
|
||||
// Make sure the task is mutually exclusive with the WooPayments task.
|
||||
return Features::is_enabled( 'payment-gateway-suggestions' ) && ! $woocommerce_payments->can_view();
|
||||
// The task is visible if WooPayments is not supported in the current store location country.
|
||||
// Otherwise, the WooPayments task will be shown.
|
||||
return Features::is_enabled( 'payment-gateway-suggestions' ) && ! WooCommercePayments::is_supported();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the store has any enabled gateways, other than WooPayments.
|
||||
* Check if the store has any enabled gateways.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -91,8 +91,7 @@ class Payments extends Task {
|
|||
$enabled_gateways = array_filter(
|
||||
$gateways,
|
||||
function( $gateway ) {
|
||||
// Filter out any WooPayments gateways as this task is mutually exclusive with the WooPayments task.
|
||||
return 'yes' === $gateway->enabled && 0 !== strpos( $gateway->id, 'woocommerce_payments' );
|
||||
return 'yes' === $gateway->enabled;
|
||||
}
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue