Automattic\WooCommerce\StoreApi\Routes\V1

Checkout::update_order_from_request()privateWC 1.0

Update the current order using the posted values from the request.

{} Это метод класса: Checkout{}

Возвращает

null. Ничего.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->update_order_from_request( $request );
$request(\WP_REST_Request) (обязательный)
Full details about the request.

Код Checkout::update_order_from_request() WC 6.7.0

private function update_order_from_request( \WP_REST_Request $request ) {
	$this->order->set_customer_note( $request['customer_note'] ?? '' );
	$this->order->set_payment_method( $this->get_request_payment_method_id( $request ) );

	wc_do_deprecated_action(
		'__experimental_woocommerce_blocks_checkout_update_order_from_request',
		array(
			$this->order,
			$request,
		),
		'6.3.0',
		'woocommerce_store_api_checkout_update_order_from_request',
		'This action was deprecated in WooCommerce Blocks version 6.3.0. Please use woocommerce_store_api_checkout_update_order_from_request instead.'
	);

	wc_do_deprecated_action(
		'woocommerce_blocks_checkout_update_order_from_request',
		array(
			$this->order,
			$request,
		),
		'7.2.0',
		'woocommerce_store_api_checkout_update_order_from_request',
		'This action was deprecated in WooCommerce Blocks version 7.2.0. Please use woocommerce_store_api_checkout_update_order_from_request instead.'
	);

	/**
	 * Fires when the Checkout Block/Store API updates an order's from the API request data.
	 *
	 * This hook gives extensions the chance to update orders based on the data in the request. This can be used in
	 * conjunction with the ExtendSchema class to post custom data and then process it.
	 *
	 * @param \WC_Order $order Order object.
	 * @param \WP_REST_Request $request Full details about the request.
	 */
	do_action( 'woocommerce_store_api_checkout_update_order_from_request', $this->order, $request );

	$this->order->save();
}