Automattic\WooCommerce\Internal\Admin\Orders

PageController::set_order_type()privateWC 1.0

Determines the order type for the current screen.

Method of the class: PageController{}

No Hooks.

Return

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->set_order_type();

PageController::set_order_type() code WC 9.0.1

private function set_order_type() {
	global $plugin_page;

	$this->order_type = str_replace( array( 'wc-orders--', 'wc-orders' ), '', $plugin_page );
	$this->order_type = empty( $this->order_type ) ? 'shop_order' : $this->order_type;

	$wc_order_type = wc_get_order_type( $this->order_type );
	$wp_order_type = get_post_type_object( $this->order_type );

	if ( ! $wc_order_type || ! $wp_order_type || ! $wp_order_type->show_ui || ! current_user_can( $wp_order_type->cap->edit_posts ) ) {
		wp_die();
	}
}