Automattic\WooCommerce\StoreApi\Utilities
CartController::calculate_totals()
Recalculates the cart totals and returns the updated cart instance.
Method of the class: CartController{}
No Hooks.
Return
\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 9.5.1
public function calculate_totals() { $cart = $this->get_cart_instance(); $cart->get_cart(); $cart->calculate_fees(); $cart->calculate_totals(); return $cart; }