Automattic\WooCommerce\StoreApi\Routes\V1

CartCoupons::get_route_delete_response()protectedWC 1.0

Deletes all coupons in the cart.

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

Хуков нет.

Возвращает

\WP_REST_Response.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_route_delete_response( $request );
$request(\WP_REST_Request) (обязательный)
Request object.

Код CartCoupons::get_route_delete_response() WC 8.7.0

protected function get_route_delete_response( \WP_REST_Request $request ) {
	$cart = $this->cart_controller->get_cart_instance();

	$cart->remove_coupons();
	$cart->calculate_totals();

	return new \WP_REST_Response( [], 200 );
}