You are here

public function Subscription::getUnitPrice in Commerce Recurring Framework 8

Gets the subscription unit price.

Return value

\Drupal\commerce_price\Price The subscription unit price.

Overrides SubscriptionInterface::getUnitPrice

File

src/Entity/Subscription.php, line 259

Class

Subscription
Defines the subscription entity.

Namespace

Drupal\commerce_recurring\Entity

Code

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