Automattic\WooCommerce\Admin\API
OnboardingProfile::core_profiler_step_complete
Mark a core profiler step as complete.
Method of the class: OnboardingProfile{}
Hooks from the method
Returns
WP_Error|WP_REST_Response.
Usage
$OnboardingProfile = new OnboardingProfile(); $OnboardingProfile->core_profiler_step_complete( $request );
- $request(WP_REST_Request) (required)
- Request data.
OnboardingProfile::core_profiler_step_complete() OnboardingProfile::core profiler step complete code WC 10.4.3
public function core_profiler_step_complete( $request ) {
$json = $request->get_json_params();
$step = $json['step'];
$onboarding_progress = (array) get_option( Profile::PROGRESS_OPTION, array() );
if ( ! isset( $onboarding_progress['core_profiler_completed_steps'] ) ) {
$onboarding_progress['core_profiler_completed_steps'] = array();
}
$onboarding_progress['core_profiler_completed_steps'][ $step ] = array(
'completed_at' => gmdate( 'Y-m-d\TH:i:s\Z' ),
);
update_option( Profile::PROGRESS_OPTION, $onboarding_progress );
/**
* Fires when a core profiler step is completed.
*
* @since 6.5.0
* @param string $step The completed step name.
*/
do_action( 'woocommerce_core_profiler_step_complete', $step );
$response_data = array(
'results' => $onboarding_progress,
'status' => 'success',
);
$response = rest_ensure_response( $response_data );
return $response;
}