You are here

public function Shipment::getAmount in Commerce Shipping 8.2

Gets the amount.

Calculated from the original amount by applying promotions and fees during order refresh.

Return value

\Drupal\commerce_price\Price|null The shipment amount, or NULL if unknown.

Overrides ShipmentInterface::getAmount

1 call to Shipment::getAmount()
Shipment::getAdjustedAmount in src/Entity/Shipment.php
Gets the adjusted amount.

File

src/Entity/Shipment.php, line 334

Class

Shipment
Defines the shipment entity class.

Namespace

Drupal\commerce_shipping\Entity

Code

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