WC_REST_WCCOM_Site_Installer_Controller::success_response()protectedWC 1.0

Generate a standardized response for a successful request.

Method of the class: WC_REST_WCCOM_Site_Installer_Controller{}

No Hooks.

Return

WP_REST_Response|WP_Error.

Usage

// protected - for code of main (parent) or child class
$result = $this->success_response( $product_id );
$product_id(int) (required)
Product ID.

WC_REST_WCCOM_Site_Installer_Controller::success_response() code WC 9.4.2

protected function success_response( $product_id ) {
	$state    = WC_WCCOM_Site_Installation_State_Storage::get_state( $product_id );
	$response = rest_ensure_response(
		array(
			'success' => true,
			'state'   => $state ? $this->map_state_to_response( $state ) : null,
		)
	);
	$response->set_status( 200 );
	return $response;
}