Automattic\WooCommerce\Admin\API

OnboardingProfile::register_routespublicWC 1.0

Register routes.

Method of the class: OnboardingProfile{}

No Hooks.

Returns

null. Nothing (null).

Usage

$OnboardingProfile = new OnboardingProfile();
$OnboardingProfile->register_routes();

OnboardingProfile::register_routes() code WC 9.9.3

public function register_routes() {
	register_rest_route(
		$this->namespace,
		'/' . $this->rest_base,
		array(
			array(
				'methods'             => \WP_REST_Server::READABLE,
				'callback'            => array( $this, 'get_items' ),
				'permission_callback' => array( $this, 'get_items_permissions_check' ),
			),
			'schema' => array( $this, 'get_public_item_schema' ),
		)
	);
	register_rest_route(
		$this->namespace,
		'/' . $this->rest_base,
		array(
			array(
				'methods'             => \WP_REST_Server::EDITABLE,
				'callback'            => array( $this, 'update_items' ),
				'permission_callback' => array( $this, 'update_items_permissions_check' ),
				'args'                => $this->get_collection_params(),
			),
			'schema' => array( $this, 'get_public_item_schema' ),
		)
	);

	// This endpoint is experimental. For internal use only.
	register_rest_route(
		$this->namespace,
		'/' . $this->rest_base . '/experimental_get_email_prefill',
		array(
			array(
				'methods'             => \WP_REST_Server::READABLE,
				'callback'            => array( $this, 'get_email_prefill' ),
				'permission_callback' => array( $this, 'get_items_permissions_check' ),
			),
			'schema' => array( $this, 'get_public_item_schema' ),
		)
	);

	register_rest_route(
		$this->namespace,
		'/' . $this->rest_base . '/progress',
		array(
			array(
				'methods'             => \WP_REST_Server::READABLE,
				'callback'            => array( $this, 'get_profile_progress' ),
				'permission_callback' => array( $this, 'get_items_permissions_check' ),
			),
		)
	);

	register_rest_route(
		$this->namespace,
		'/' . $this->rest_base . '/progress/core-profiler/complete',
		array(
			array(
				'methods'             => \WP_REST_Server::EDITABLE,
				'callback'            => array( $this, 'core_profiler_step_complete' ),
				'permission_callback' => array( $this, 'update_items_permissions_check' ),
				'args'                => array(
					'step' => array(
						'required'    => true,
						'type'        => 'string',
						'description' => __( 'The Core Profiler step to mark as complete.', 'woocommerce' ),
						'enum'        => array(
							'intro-opt-in',
							'skip-guided-setup',
							'user-profile',
							'business-info',
							'plugins',
							'intro-builder',
							'skip-guided-setup',
						),
					),
				),
			),
		)
	);

	register_rest_route(
		$this->namespace,
		'/' . $this->rest_base . '/update-store-currency-and-measurement-units',
		array(
			array(
				'methods'             => 'POST',
				'callback'            => array( $this, 'update_store_currency_and_measurement_units' ),
				'permission_callback' => array( $this, 'update_items_permissions_check' ),
				'args'                => array(
					'country_code' => array(
						'description' => __( 'Country code.', 'woocommerce' ),
						'type'        => 'string',
						'required'    => true,
					),
				),
			),
			'schema' => array( $this, 'get_public_item_schema' ),
		)
	);
}