WC_REST_WCCOM_Site_Installer_Controller::install( WP_REST_Request $request )

Install WooCommerce.com products.


Description Description


Parameters Parameters

$request

(Required) Full details about the request.


Top ↑

Return Return

(bool|WP_Error)


Top ↑

Source Source

File: includes/wccom-site/rest-api/endpoints/class-wc-rest-wccom-site-installer-controller.php

	public function install( $request ) {
		$requirements_met = WC_WCCOM_Site_Installer_Requirements_Check::met_requirements();
		if ( is_wp_error( $requirements_met ) ) {
			return $requirements_met;
		}

		if ( empty( $request['products'] ) ) {
			return new WP_Error( 'missing_products', __( 'Missing products in request body.', 'woocommerce' ), array( 'status' => 400 ) );
		}

		$validation_result = $this->validate_products( $request['products'] );
		if ( is_wp_error( $validation_result ) ) {
			return $validation_result;
		}

		return rest_ensure_response( WC_WCCOM_Site_Installer::schedule_install( $request['products'] ) );
	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.7.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.