Automattic\WooCommerce\StoreApi\Utilities
CartController::calculate_totals
Recalculates the cart totals and returns the updated cart instance.
Method of the class: CartController{}
No Hooks.
Returns
\WC_Cart.
Usage
$CartController = new CartController(); $CartController->calculate_totals();
Changelog
| Since 9.2.0 | Introduced. |
| Since 9.2.0 | Calculate shipping was removed here because it's called already by calculate_totals. |
CartController::calculate_totals() CartController::calculate totals code WC 10.5.0
public function calculate_totals() {
$cart = $this->get_cart_instance();
$cart->get_cart();
$cart->calculate_fees();
$cart->calculate_totals();
return $cart;
}