I have a setup with two store views.
The first store view has base and the only one currency set to USD. The second one has 2 allowed currencies - USD and EUR. EUR is the default displayed one, USD is set as a base one.
All products' prices are set only in USD and the exchange rate for EUR is set to 0.75. Price of the product is let's say $14.
And my code goes:
// Store ID 2 - default currency EUR, base currency USD // $product is instance of Magento\Catalog\Model\Product $priceInfo = $product->getPriceInfo(); $price = $priceInfo->getPrice('regular_price')->getValue();
This code always fetch the correct price (10.50) in EUR. But I need both prices - in USD and in EUR, but I didn't find a way on how to pass currency to any
I tried to use
Magento\Directory\Helper\Data to convert:
$helper->currencyConvert($price, 'EUR', 'USD');
But it gives me $13.99 when the real price in USD is $14 - so the calculation is wrong.
Do you know how can I get product's prices for both store currencies? Thanks a lot!