Make sure we also track completion of non visible tasks and fix parent id in WooCommercePayments task
This commit is contained in:
parent
7d76d4a1a6
commit
a13f15624a
|
@ -350,6 +350,13 @@ class TaskList {
|
||||||
*/
|
*/
|
||||||
public function get_json() {
|
public function get_json() {
|
||||||
$this->possibly_track_completion();
|
$this->possibly_track_completion();
|
||||||
|
// Track completion of non viewable tasks.
|
||||||
|
foreach ( $this->tasks as $task ) {
|
||||||
|
if ( ! $task->can_view() ) {
|
||||||
|
$task->possibly_track_completion();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'id' => $this->get_list_id(),
|
'id' => $this->get_list_id(),
|
||||||
'title' => $this->title,
|
'title' => $this->title,
|
||||||
|
|
|
@ -73,8 +73,11 @@ class AdditionalPayments extends Payments {
|
||||||
|
|
||||||
$woocommerce_payments = new WooCommercePayments();
|
$woocommerce_payments = new WooCommercePayments();
|
||||||
|
|
||||||
if ( ! $woocommerce_payments->is_requested() || ( $woocommerce_payments->is_supported() && ! $woocommerce_payments->is_connected() ) ) {
|
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.
|
// Hide task if WC Pay is not installed via OBW, or is not connected, or the store is located in a country that is not supported by WC Pay.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ( $this->get_parent_id() === 'extended_two_column' && WooCommercePayments::is_connected() ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,15 +19,6 @@ class WooCommercePayments extends Task {
|
||||||
return 'woocommerce-payments';
|
return 'woocommerce-payments';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Parent ID.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function get_parent_id() {
|
|
||||||
return 'setup';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Title.
|
* Title.
|
||||||
*
|
*
|
||||||
|
@ -130,6 +121,7 @@ class WooCommercePayments extends Task {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function is_connected() {
|
public static function is_connected() {
|
||||||
|
return true;
|
||||||
if ( class_exists( '\WC_Payments' ) ) {
|
if ( class_exists( '\WC_Payments' ) ) {
|
||||||
$wc_payments_gateway = \WC_Payments::get_gateway();
|
$wc_payments_gateway = \WC_Payments::get_gateway();
|
||||||
return method_exists( $wc_payments_gateway, 'is_connected' )
|
return method_exists( $wc_payments_gateway, 'is_connected' )
|
||||||
|
|
Loading…
Reference in New Issue