Automattic\WooCommerce\Internal\Admin\Orders

Edit::handle_order_update()publicWC 1.0

Takes care of updating order data. Fires action that metaboxes can hook to for order data updating.

Method of the class: Edit{}

Hooks from the method

Return

null. Nothing (null).

Usage

$Edit = new Edit();
$Edit->handle_order_update();

Edit::handle_order_update() code WC 8.6.1

public function handle_order_update() {
	if ( ! isset( $this->order ) ) {
		return;
	}

	if ( 'edit_order' !== sanitize_text_field( wp_unslash( $_POST['action'] ?? '' ) ) ) {
		return;
	}

	check_admin_referer( $this->get_order_edit_nonce_action() );

	// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- sanitized later on by taxonomies_meta_box object.
	$taxonomy_input = isset( $_POST['tax_input'] ) ? wp_unslash( $_POST['tax_input'] ) : null;
	$this->taxonomies_meta_box->save_taxonomies( $this->order, $taxonomy_input );

	/**
	 * Save meta for shop order.
	 *
	 * @param int Order ID.
	 * @param \WC_Order Post object.
	 *
	 * @since 2.1.0
	 */
	do_action( 'woocommerce_process_shop_order_meta', $this->order->get_id(), $this->order );

	$this->custom_meta_box->handle_metadata_changes($this->order);

	// Order updated message.
	$this->message = 1;

	// Claim lock.
	$edit_lock = wc_get_container()->get( EditLock::class );
	$edit_lock->lock( $this->order );

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