You are here

public function OrderItem::getTotalPrice in Commerce Core 8.2

Gets the order item total price.

Return value

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

Overrides OrderItemInterface::getTotalPrice

1 call to OrderItem::getTotalPrice()
OrderItem::getAdjustedTotalPrice in modules/order/src/Entity/OrderItem.php
Gets the adjusted order item total price.

File

modules/order/src/Entity/OrderItem.php, line 148

Class

OrderItem
Defines the order item entity class.

Namespace

Drupal\commerce_order\Entity

Code

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