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.
Thanks to Chance G I was able to achieve what I needed by:
$product_variation = $order_item->getPurchasedEntity(); $product_id = $product_variation->product_id->getString(); $product = \Drupal\commerce_product\Entity\Product::load($product_id); $product_title = $product->getTitle();