Drupal 7 : Loading Order Details from LineItem ID

The Line Items in Drupal commerce used to refer the product in Order. Using the Line Item id we can able to load order details. The function commerce_line_item_load() will contains respective order ID of the order. We can able to get the order details from order ID using the function commerce_order_load().

Syntax:

$lineItem = commerce_line_item_load(LINE_ITEM); // Loading Line Item.
$orderInfo = commerce_order_load($lineItem->order_id); //Loading Order Information.

Example:

$lineItem = commerce_line_item_load(12345); // Loading Line Item.
$orderInfo = commerce_order_load($lineItem->order_id); // Loading Order information.
$orderUser = $order_info->uid; // Order user ID.
$orderId = $order->order_id; // Order ID from Order.
$status = $order->status; // Accessing Order status.
Category: