WC_REST_WCCOM_Site_Connection_Controller::handle_disconnect_request()publicWC 9.6.0

Disconnect the site from WooCommerce.com.

Метод класса: WC_REST_WCCOM_Site_Connection_Controller{}

Хуков нет.

Возвращает

WP_REST_Response.

Использование

$WC_REST_WCCOM_Site_Connection_Controller = new WC_REST_WCCOM_Site_Connection_Controller();
$WC_REST_WCCOM_Site_Connection_Controller->handle_disconnect_request( $request );
$request(WP_REST_Request) (обязательный)
Full details about the request.

Список изменений

С версии 9.6.0 Введена.

Код WC_REST_WCCOM_Site_Connection_Controller::handle_disconnect_request() WC 9.8.1

public function handle_disconnect_request( $request ) {
	$request_hash = $request['hash'];
	if ( empty( $request_hash ) || ! WC_Helper::verify_request_hash( $request_hash ) ) {
		return $this->get_response(
			array(),
			403
		);
	}

	if ( WC_Helper::is_site_connected() ) {
		WC_Helper::disconnect();
	}

	return $this->get_response(
		array(
			'status' => true,
		)
	);
}