WC_Order_Item_Data_Store::get_order_item_type()publicWC 3.0.0

Get the order item type based on Item ID.

Method of the class: WC_Order_Item_Data_Store{}

No Hooks.

Return

String|null. Order item type or null if no order item entry found.

Usage

$WC_Order_Item_Data_Store = new WC_Order_Item_Data_Store();
$WC_Order_Item_Data_Store->get_order_item_type( $item_id );
$item_id(int) (required)
Item ID.

Changelog

Since 3.0.0 Introduced.

WC_Order_Item_Data_Store::get_order_item_type() code WC 9.4.2

public function get_order_item_type( $item_id ) {
	global $wpdb;
	$order_item_type = $wpdb->get_var(
		$wpdb->prepare(
			"SELECT order_item_type FROM {$wpdb->prefix}woocommerce_order_items WHERE order_item_id = %d LIMIT 1;",
			$item_id
		)
	);

	return $order_item_type;
}