Move payments task to extended task list when WC Pay task is shown (https://github.com/woocommerce/woocommerce-admin/pull/7980)
* Move payments task to extended list if wc pay task is shown * Delete additional payment gateway note if no longer applicable * Add changelog entry
This commit is contained in:
parent
d692986e11
commit
9eca023fb4
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: Update
|
||||
|
||||
Move payments task to extended task list when WC Pay task is shown #7980
|
|
@ -52,6 +52,7 @@ use \Automattic\WooCommerce\Admin\Notes\NavigationNudge;
|
|||
use Automattic\WooCommerce\Admin\Schedulers\MailchimpScheduler;
|
||||
use \Automattic\WooCommerce\Admin\Notes\CompleteStoreDetails;
|
||||
use \Automattic\WooCommerce\Admin\Notes\UpdateStoreDetails;
|
||||
use \Automattic\WooCommerce\Admin\Notes\SetUpAdditionalPaymentTypes;
|
||||
|
||||
/**
|
||||
* Events Class.
|
||||
|
@ -164,6 +165,7 @@ class Events {
|
|||
NavigationNudge::delete_if_not_applicable();
|
||||
NavigationFeedback::delete_if_not_applicable();
|
||||
NavigationFeedbackFollowUp::delete_if_not_applicable();
|
||||
SetUpAdditionalPaymentTypes::delete_if_not_applicable();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -25,7 +25,8 @@ class Payments extends Task {
|
|||
* @return string
|
||||
*/
|
||||
public function get_parent_id() {
|
||||
return 'setup';
|
||||
$woocommerce_payments = new WooCommercePayments();
|
||||
return $woocommerce_payments->can_view() ? 'extended' : 'setup';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -34,7 +35,10 @@ class Payments extends Task {
|
|||
* @return string
|
||||
*/
|
||||
public function get_title() {
|
||||
return __( 'Set up payments', 'woocommerce-admin' );
|
||||
$woocommerce_payments = new WooCommercePayments();
|
||||
return $woocommerce_payments->can_view()
|
||||
? __( 'Set up additional payment providers', 'woocommerce-admin' )
|
||||
: __( 'Set up payments', 'woocommerce-admin' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -73,13 +77,7 @@ class Payments extends Task {
|
|||
* @return bool
|
||||
*/
|
||||
public function can_view() {
|
||||
return Features::is_enabled( 'payment-gateway-suggestions' ) &&
|
||||
(
|
||||
! WooCommercePayments::is_requested() ||
|
||||
! WooCommercePayments::is_installed() ||
|
||||
! WooCommercePayments::is_supported() ||
|
||||
WooCommercePayments::is_connected()
|
||||
);
|
||||
return Features::is_enabled( 'payment-gateway-suggestions' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -92,7 +90,7 @@ class Payments extends Task {
|
|||
$enabled_gateways = array_filter(
|
||||
$gateways,
|
||||
function( $gateway ) {
|
||||
return 'yes' === $gateway->enabled;
|
||||
return 'yes' === $gateway->enabled && 'woocommerce_payments' !== $gateway->id;
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@ namespace Automattic\WooCommerce\Admin\Notes;
|
|||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
use Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks\WooCommercePayments;
|
||||
|
||||
/**
|
||||
* Set_Up_Additional_Payment_Types
|
||||
*/
|
||||
|
@ -73,6 +75,14 @@ class SetUpAdditionalPaymentTypes {
|
|||
self::possibly_delete_note();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this note should exist.
|
||||
*/
|
||||
public static function is_applicable() {
|
||||
$woocommerce_payments = new WooCommercePayments();
|
||||
return ! $woocommerce_payments->can_view();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the note.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue