Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks
Products::maybe_revert_on_shutdown
Re-check whether valid products still exist and revert task completion if none remain.
Runs once at the end of the request via the shutdown hook.
Method of the class: Products{}
No Hooks.
Returns
null. Nothing (null).
Usage
$Products = new Products(); $Products->maybe_revert_on_shutdown(): void;
Products::maybe_revert_on_shutdown() Products::maybe revert on shutdown code WC 10.6.2
public function maybe_revert_on_shutdown(): void {
self::$revert_scheduled = false;
if ( self::has_products() ) {
return;
}
$completed_tasks = get_option( self::COMPLETED_OPTION, array() );
$task_id = $this->get_id();
if ( in_array( $task_id, $completed_tasks, true ) ) {
$completed_tasks = array_values( array_diff( $completed_tasks, array( $task_id ) ) );
update_option( self::COMPLETED_OPTION, $completed_tasks );
}
}