Automattic\WooCommerce\Blocks\StoreApi\Utilities
OrderController::update_order_from_cart() public WC 1.0
Update an order using data from the current cart.
{} Это метод класса: OrderController{}
Хуков нет.
Возвращает
Null. Ничего.
Использование
$OrderController = new OrderController(); $OrderController->update_order_from_cart( \WC_Order $order );
- \WC_Order $order (обязательный)
- -
Код OrderController::update_order_from_cart() OrderController::update order from cart WC 5.0.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();
}