You are here

public function Order::getTotalPrice in Commerce Core 8.2

Gets the order total price.

Represents a sum of all order item totals along with adjustments.

Return value

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

Overrides OrderInterface::getTotalPrice

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

File

modules/order/src/Entity/Order.php, line 467

Class

Order
Defines the order entity class.

Namespace

Drupal\commerce_order\Entity

Code

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