ed' ); } } /** * Records an event for individual task completion. * * @param mixed $old_value Old value. * @param mixed $new_value New value. */ public static function track_task_completion( $old_value, $new_value ) { $old_value = is_array( $old_value ) ? $old_value : array(); $untracked_tasks = array_diff( $new_value, $old_value ); foreach ( $untracked_tasks as $task ) { wc_admin_record_tracks_event( 'tasklist_task_completed', array( 'task_name' => $task ) ); } } /** * Update registered extended task list items. */ public static function update_option_extended_task_list() { if ( ! \Automattic\WooCommerce\Admin\Loader::is_admin_page() || ! \Automattic\WooCommerce\Admin\Features\Onboarding::should_show_tasks() ) { return; } $extended_tasks_list_items = get_option( 'woocommerce_extended_task_list_items', array() ); $registered_extended_tasks_list_items = apply_filters( 'woocommerce_get_registered_extended_tasks', array() ); if ( $registered_extended_tasks_list_items !== $extended_tasks_list_items ) { update_option( 'woocommerce_extended_task_list_items', $registered_extended_tasks_list_items ); update_option( 'woocommerce_extended_task_list_hidden', 'no' ); } } }