Automattic\WooCommerce\StoreApi\Routes\V1

Checkout::update_order_from_request()privateWC 1.0

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

Method of the class: Checkout{}

Return

null. Nothing.

Usage

// private - for code of main (parent) class only
$result = $this->update_order_from_request( $request );
$request(\WP_REST_Request) (required)
Full details about the request.

Checkout::update_order_from_request() code WC 7.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.
	 *
	 * @since 7.2.0
	 *
	 * @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();
}