Automattic\WooCommerce\Internal\Admin\Orders

Edit::setup()publicWC 1.0

Setup hooks, actions and variables needed to render order edit page.

Method of the class: Edit{}

Return

null. Nothing (null).

Usage

$Edit = new Edit();
$Edit->setup( $order );
$order(\WC_Order) (required)
Order object.

Edit::setup() code WC 8.7.0

public function setup( \WC_Order $order ) {
	$this->order    = $order;
	$current_screen = get_current_screen();
	$current_screen->is_block_editor( false );
	$this->screen_id = $current_screen->id;
	if ( ! isset( $this->custom_meta_box ) ) {
		$this->custom_meta_box = wc_get_container()->get( CustomMetaBox::class );
	}

	if ( ! isset( $this->taxonomies_meta_box ) ) {
		$this->taxonomies_meta_box = wc_get_container()->get( TaxonomiesMetaBox::class );
	}

	$this->add_save_meta_boxes();
	$this->handle_order_update();
	$this->add_order_meta_boxes( $this->screen_id, __( 'Order', 'woocommerce' ) );
	$this->add_order_specific_meta_box();
	$this->add_order_taxonomies_meta_box();

	/**
	 * From wp-admin/includes/meta-boxes.php.
	 *
	 * Fires after all built-in meta boxes have been added. Custom metaboxes may be enqueued here.
	 *
	 * @since 3.8.0.
	 */
	do_action( 'add_meta_boxes', $this->screen_id, $this->order );

	/**
	 * Provides an opportunity to inject custom meta boxes into the order editor screen. This
	 * hook is an analog of `add_meta_boxes_<POST_TYPE>` as provided by WordPress core.
	 *
	 * @since 7.4.0
	 *
	 * @oaram WC_Order $order The order being edited.
	 */
	do_action( 'add_meta_boxes_' . $this->screen_id, $this->order );

	$this->enqueue_scripts();
}