You are here

protected function FixedAmountOffTrait::getAmount in Commerce Core 8.2

Gets the offer amount.

Return value

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

2 calls to FixedAmountOffTrait::getAmount()
OrderFixedAmountOff::apply in modules/promotion/src/Plugin/Commerce/PromotionOffer/OrderFixedAmountOff.php
Applies the offer to the given entity.
OrderItemFixedAmountOff::apply in modules/promotion/src/Plugin/Commerce/PromotionOffer/OrderItemFixedAmountOff.php
Applies the offer to the given entity.

File

modules/promotion/src/Plugin/Commerce/PromotionOffer/FixedAmountOffTrait.php, line 63

Class

FixedAmountOffTrait
Provides common configuration for fixed amount off offers.

Namespace

Drupal\commerce_promotion\Plugin\Commerce\PromotionOffer

Code

protected function getAmount() {
  if (!empty($this->configuration['amount'])) {
    $amount = $this->configuration['amount'];
    return new Price($amount['number'], $amount['currency_code']);
  }
}