You are here

public function ProductBundleItem::hasProduct in Commerce Product Bundle 8

Gets whether the bundle item has a product set or not.

Return value

bool TRUE if the bundle item contains a product reference. FALSE otherwise.

Overrides BundleItemInterface::hasProduct

5 calls to ProductBundleItem::hasProduct()
ProductBundleItem::addVariation in src/Entity/ProductBundleItem.php
Adds a variation.
ProductBundleItem::getDefaultVariation in src/Entity/ProductBundleItem.php
Get the default variation.
ProductBundleItem::getProduct in src/Entity/ProductBundleItem.php
Get the referenced product.
ProductBundleItem::getVariations in src/Entity/ProductBundleItem.php
Gets the product variations limited by the bundle item or enabled on the product.
ProductBundleItem::setProduct in src/Entity/ProductBundleItem.php
@inheritdoc

File

src/Entity/ProductBundleItem.php, line 270

Class

ProductBundleItem
Defines the product bundle item entity.

Namespace

Drupal\commerce_product_bundle\Entity

Code

public function hasProduct() {
  return !$this
    ->get('product')
    ->isEmpty();
}