You are here

public function ProductBundleItem::getProduct in Commerce Product Bundle 8

Get the referenced product.

Return value

null|\Drupal\commerce_product\Entity\ProductInterface The referenced commerce product or null if no product is referenced.

Overrides BundleItemInterface::getProduct

1 call to ProductBundleItem::getProduct()
ProductBundleItem::getEnabledVariations in src/Entity/ProductBundleItem.php
Get the enabled product variations.

File

src/Entity/ProductBundleItem.php, line 277

Class

ProductBundleItem
Defines the product bundle item entity.

Namespace

Drupal\commerce_product_bundle\Entity

Code

public function getProduct() {
  if ($this
    ->hasProduct()) {
    return $this
      ->get('product')
      ->referencedEntities()[0];
  }
}