You are here

public function PriceListItem::getPrice in Commerce Pricelist 8

Same name and namespace in other branches
  1. 8.2 src/Entity/PriceListItem.php \Drupal\commerce_pricelist\Entity\PriceListItem::getPrice()

Gets the price list item price.

Return value

\Drupal\commerce_price\Price The price.

Overrides PriceListItemInterface::getPrice

File

src/Entity/PriceListItem.php, line 157

Class

PriceListItem
Defines the price list item entity.

Namespace

Drupal\commerce_pricelist\Entity

Code

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