You are here

public function CommerceCurrencyResolverAmountTrait::shouldCurrencyRefresh in Commerce Currency Resolver 8

Do not run conditions currency conversion on specific conditions.

Parameters

string $currency_code: Current currency on plugin.

Return value

bool Return TRUE if is allowed.

3 calls to CommerceCurrencyResolverAmountTrait::shouldCurrencyRefresh()
OrderFixedAmountOff::apply in src/Plugin/Commerce/PromotionOffer/OrderFixedAmountOff.php
Applies the offer to the given entity.
OrderItemFixedAmountOff::apply in src/Plugin/Commerce/PromotionOffer/OrderItemFixedAmountOff.php
Applies the offer to the given entity.
OrderTotalPrice::evaluate in src/Plugin/Commerce/Condition/OrderTotalPrice.php
Evaluates the condition.

File

src/Plugin/Commerce/CommerceCurrencyResolverAmountTrait.php, line 119

Class

CommerceCurrencyResolverAmountTrait
Provides common configuration for fixed amount off offers.

Namespace

Drupal\commerce_currency_resolver\Plugin\Commerce

Code

public function shouldCurrencyRefresh($currency_code) {

  // No conversion for CLI tasks.
  if (PHP_SAPI === 'cli') {
    return FALSE;
  }

  // Different currencies, it is needed to refresh.
  return $this
    ->currentCurrency() !== $currency_code;
}