Automattic\WooCommerce\StoreApi\Utilities

CartController::get_cart_for_responsepublicWC 1.0

Gets the latest cart instance, and ensures totals have been calculated before returning.

Method of the class: CartController{}

No Hooks.

Returns

\WC_Cart.

Usage

$CartController = new CartController();
$CartController->get_cart_for_response();

CartController::get_cart_for_response() code WC 9.9.3

public function get_cart_for_response() {
	return did_action( 'woocommerce_after_calculate_totals' ) ? $this->get_cart_instance() : $this->calculate_totals();
}