Automattic\WooCommerce\StoreApi\Routes\V1
AbstractCartRoute::cart_updated()
Triggered after an update to cart data. Re-calculates totals and updates draft orders (if they already exist) to keep all data in sync.
Метод класса: AbstractCartRoute{}
Хуки из метода
Возвращает
null
. Ничего (null).
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->cart_updated( $request );
- $request(\WP_REST_Request) (обязательный)
- Request object.
Код AbstractCartRoute::cart_updated() AbstractCartRoute::cart updated WC 9.5.1
protected function cart_updated( \WP_REST_Request $request ) { $draft_order = $this->get_draft_order(); if ( $draft_order ) { // This does not trigger a recalculation of the cart--endpoints should have already done so before returning // the cart response. $this->order_controller->update_order_from_cart( $draft_order, false ); wc_do_deprecated_action( 'woocommerce_blocks_cart_update_order_from_request', array( $draft_order, $request, ), '7.2.0', 'woocommerce_store_api_cart_update_order_from_request', 'This action was deprecated in WooCommerce Blocks version 7.2.0. Please use woocommerce_store_api_cart_update_order_from_request instead.' ); /** * Fires when the order is synced with cart data from a cart route. * * @since 7.2.0 * * @param \WC_Order $draft_order Order object. * @param \WC_Customer $customer Customer object. * @param \WP_REST_Request $request Full details about the request. */ do_action( 'woocommerce_store_api_cart_update_order_from_request', $draft_order, $request ); } }