WC_REST_WCCOM_Site_Installer_Controller::install
Install WooCommerce.com products.
Method of the class: WC_REST_WCCOM_Site_Installer_Controller{}
No Hooks.
Returns
WP_REST_Response|WP_Error.
Usage
$WC_REST_WCCOM_Site_Installer_Controller = new WC_REST_WCCOM_Site_Installer_Controller(); $WC_REST_WCCOM_Site_Installer_Controller->install( $request );
- $request(WP_REST_Request) (required)
- Full details about the request.
Changelog
| Since 7.7.0 | Introduced. |
WC_REST_WCCOM_Site_Installer_Controller::install() WC REST WCCOM Site Installer Controller::install code WC 10.6.2
woocommerce/includes/wccom-site/rest-api/endpoints/class-wc-rest-wccom-site-installer-controller.php
public function install( $request ) {
try {
$product_id = $request['product-id'];
$run_until_step = $request['run-until-step'];
$idempotency_key = $request['idempotency-key'];
$installation_manager = new WC_WCCOM_Site_Installation_Manager( $product_id, $idempotency_key );
$installation_manager->run_installation( $run_until_step );
$response = $this->success_response( $product_id );
} catch ( Installer_Error $exception ) {
$response = $this->failure_response( $product_id, $exception );
}
return $response;
}