diff --git a/plugins/woocommerce/changelog/fix-marketing-task b/plugins/woocommerce/changelog/fix-marketing-task new file mode 100644 index 00000000000..71ecb38cb41 --- /dev/null +++ b/plugins/woocommerce/changelog/fix-marketing-task @@ -0,0 +1,4 @@ +Significance: minor +Type: update + +Remove remote API call from marketing task diff --git a/plugins/woocommerce/src/Admin/Features/OnboardingTasks/Tasks/Marketing.php b/plugins/woocommerce/src/Admin/Features/OnboardingTasks/Tasks/Marketing.php index d50b387e9ad..347e8986f2d 100644 --- a/plugins/woocommerce/src/Admin/Features/OnboardingTasks/Tasks/Marketing.php +++ b/plugins/woocommerce/src/Admin/Features/OnboardingTasks/Tasks/Marketing.php @@ -56,79 +56,40 @@ class Marketing extends Task { return __( '2 minutes', 'woocommerce' ); } - /** - * Task completion. - * - * @return bool - */ - public function is_complete() { - if ( null === $this->is_complete_result ) { - $this->is_complete_result = self::has_installed_extensions(); - } - - return $this->is_complete_result; - } - /** * Task visibility. * * @return bool */ public function can_view() { - return Features::is_enabled( 'remote-free-extensions' ) && count( self::get_plugins() ) > 0; + return Features::is_enabled( 'remote-free-extensions' ); } /** * Get the marketing plugins. * + * @deprecated 9.3.0 Removed to improve performance. * @return array */ public static function get_plugins() { - $bundles = RemoteFreeExtensions::get_extensions( - array( - 'task-list/reach', - 'task-list/grow', - ) - ); - - return array_reduce( - $bundles, - function( $plugins, $bundle ) { - $visible = array(); - foreach ( $bundle['plugins'] as $plugin ) { - if ( $plugin->is_visible ) { - $visible[] = $plugin; - } - } - return array_merge( $plugins, $visible ); - }, - array() + wc_deprecated_function( + __METHOD__, + '9.3.0' ); + return array(); } /** * Check if the store has installed marketing extensions. * + * @deprecated 9.3.0 Removed to improve performance. * @return bool */ public static function has_installed_extensions() { - $plugins = self::get_plugins(); - $remaining = array(); - $installed = array(); - - foreach ( $plugins as $plugin ) { - if ( ! $plugin->is_installed ) { - $remaining[] = $plugin; - } else { - $installed[] = $plugin; - } - } - - // Make sure the task has been actioned and a marketing extension has been installed. - if ( count( $installed ) > 0 && Task::is_task_actioned( 'marketing' ) ) { - return true; - } - + wc_deprecated_function( + __METHOD__, + '9.3.0' + ); return false; } }