Abstract_WC_Order_Data_Store_CPT::get_order_item_type()
Return the order type of a given item which belongs to WC_Order.
Method of the class: Abstract_WC_Order_Data_Store_CPT{}
No Hooks.
Return
String
. Order Item type
Usage
$Abstract_WC_Order_Data_Store_CPT = new Abstract_WC_Order_Data_Store_CPT(); $Abstract_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.
Changelog
Since 3.2.0 | Introduced. |
Abstract_WC_Order_Data_Store_CPT::get_order_item_type() Abstract WC Order Data Store CPT::get order item type code WC 9.4.2
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 ) ); }