WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Blocks\StoreApi\Utilities

OrderController::update_order_from_cart() public WC 1.0

Update an order using data from the current cart.

{} It's a method of the class: OrderController{}

No Hooks.

Return

null. Nothing.

Usage

$OrderController = new OrderController();
$OrderController->update_order_from_cart( $order );
$order(WC_Order) (required)
The order object to update.

Code of OrderController::update_order_from_cart() WC 5.8.0

public function update_order_from_cart( \WC_Order $order ) {
	// Ensure cart is current.
	wc()->cart->calculate_shipping();
	wc()->cart->calculate_totals();

	// Update the current order to match the current cart.
	$this->update_line_items_from_cart( $order );
	$this->update_addresses_from_cart( $order );
	$order->set_currency( get_woocommerce_currency() );
	$order->set_prices_include_tax( 'yes' === get_option( 'woocommerce_prices_include_tax' ) );
	$order->set_customer_id( get_current_user_id() );
	$order->set_customer_ip_address( \WC_Geolocation::get_ip_address() );
	$order->set_customer_user_agent( wc_get_user_agent() );
	$order->update_meta_data( 'is_vat_exempt', wc()->cart->get_customer()->get_is_vat_exempt() ? 'yes' : 'no' );
	$order->calculate_totals();
}