WordPress at Your Fingertips
function is not described

WC_Order_Item_Data_Store::get_order_id_by_order_item_id() public WC 3.0.0

Get order ID by order item ID.

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

No Hooks.

Return

Int.

Usage

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

Changelog

Since 3.0.0 Introduced.

Code of WC_Order_Item_Data_Store::get_order_id_by_order_item_id() WC 5.8.0

public function get_order_id_by_order_item_id( $item_id ) {
	global $wpdb;
	return (int) $wpdb->get_var(
		$wpdb->prepare(
			"SELECT order_id FROM {$wpdb->prefix}woocommerce_order_items WHERE order_item_id = %d",
			$item_id
		)
	);
}