You are here

public function Invoice::getTotalPrice in Commerce Invoice 8.2

Gets the invoice total price.

Represents a sum of all invoice item totals.

Return value

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

Overrides InvoiceInterface::getTotalPrice

3 calls to Invoice::getTotalPrice()
Invoice::getBalance in src/Entity/Invoice.php
Gets the invoice balance.
Invoice::getTotalPaid in src/Entity/Invoice.php
Gets the total paid price.
Invoice::isPaid in src/Entity/Invoice.php
Gets whether the invoice has been fully paid.

File

src/Entity/Invoice.php, line 421

Class

Invoice
Defines the invoice entity class.

Namespace

Drupal\commerce_invoice\Entity

Code

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