You are here

public function ProductBundle::getPrice in Commerce Product Bundle 8

Gets the purchasable entity's price.

Return value

\Drupal\commerce_price\Price|null The price, or NULL.

Overrides PurchasableEntityInterface::getPrice

File

src/Entity/ProductBundle.php, line 197

Class

ProductBundle
Defines the product bundle entity.

Namespace

Drupal\commerce_product_bundle\Entity

Code

public function getPrice() {
  if ($this
    ->get('bundle_price')
    ->isEmpty()) {
    return NULL;
  }
  return $this
    ->get('bundle_price')
    ->first()
    ->toPrice();
}