In Commerce 2, how can I load an order item's 'purchased entity' object given its ID? I have need to load an order item's 'purchased entity' object so that I can object the base product's title for an order item.

In my scope, I have the order_item object and, from there I have access to the 'purchased entity' ID number. But I can figure out how to load the 'purchased entity'object from this ID number.

EDIT:

Thanks to Chance G I was able to achieve what I needed by:

  $product_variation = $order_item-&gt;getPurchasedEntity();
  $product_id = $product_variation-&gt;product_id-&gt;getString();
  $product = \Drupal\commerce_product\Entity\Product::load($product_id);
  $product_title = $product-&gt;getTitle();
If your $order_item is an instance of the OrderItem class you should be able to do:

$product_variation = $order_item-&gt;getPurchasedEntity();
$title = $product_variation-&gt;getTitle();


If you have an $order you should be able to do:

foreach ($order-&gt;getItems() as $order_item) {
  $product_variation = $order_item-&gt;getPurchasedEntity();
  $title = $product_variation-&gt;getTitle();
}