diff --git a/config/services/providers.xml b/config/services/providers.xml index 9374b79f..30bab7cd 100644 --- a/config/services/providers.xml +++ b/config/services/providers.xml @@ -18,6 +18,7 @@ + diff --git a/src/Infrastructure/Provider/ProductVariantsPricesProvider.php b/src/Infrastructure/Provider/ProductVariantsPricesProvider.php index 1023cf80..2bd5baaa 100644 --- a/src/Infrastructure/Provider/ProductVariantsPricesProvider.php +++ b/src/Infrastructure/Provider/ProductVariantsPricesProvider.php @@ -21,6 +21,7 @@ use Sylius\Component\Core\Model\ProductVariantInterface; use Sylius\Component\Core\Provider\ProductVariantsPricesProviderInterface; use Sylius\Component\Currency\Model\CurrencyInterface; +use Sylius\Component\Locale\Context\LocaleContextInterface; use Sylius\Component\Product\Model\ProductOptionValueInterface; use Sylius\PriceHistoryPlugin\Application\Calculator\ProductVariantLowestPriceCalculatorInterface; use Sylius\PriceHistoryPlugin\Domain\Model\ChannelInterface; @@ -34,6 +35,7 @@ public function __construct( private ProductVariantPricesCalculatorInterface $productVariantPriceCalculator, private MoneyFormatterInterface $moneyFormatter, private TranslatorInterface $translator, + private LocaleContextInterface $localeContext, ) { } @@ -71,6 +73,9 @@ private function constructOptionsMap(ProductVariantInterface $variant, ChannelIn /** @var string $currencyCode */ $currencyCode = $currency->getCode(); + /** @var string $localeCode */ + $localeCode = $this->localeContext->getLocaleCode(); + $lowestPriceBeforeDiscount = $this->productVariantLowestPriceCalculator ->calculateLowestPriceBeforeDiscount($variant, ['channel' => $channel]) ; @@ -84,6 +89,7 @@ private function constructOptionsMap(ProductVariantInterface $variant, ChannelIn '%price%' => $this->moneyFormatter->format( $lowestPriceBeforeDiscount, $currencyCode, + $localeCode ), ], );