WordPress at Your Fingertips
function is not described

WC_Order_Data_Store_CPT::get_order_item_type() public WC 3.2.0

Return the order type of a given item which belongs to WC_Order.

{} It's a method of the class: WC_Order_Data_Store_CPT{}

No Hooks.


String. Order Item type


$WC_Order_Data_Store_CPT = new WC_Order_Data_Store_CPT();
$WC_Order_Data_Store_CPT->get_order_item_type( $order, $order_item_id );
$order(WC_Order) (required)
Order Object.
$order_item_id(int) (required)
Order item id.


Since 3.2.0 Introduced.

Code of WC_Order_Data_Store_CPT::get_order_item_type() WC 5.8.0

public function get_order_item_type( $order, $order_item_id ) {
	global $wpdb;
	return $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT order_item_type FROM {$wpdb->prefix}woocommerce_order_items WHERE order_id = %d and order_item_id = %d;", $order->get_id(), $order_item_id ) );