0

my site is running in multi-store view using store code in url .
now
1 > product price in GBP = 20
2 > exchange rate for USD = 1.4
3 > for usd store i want to get price including exchange rate
4 > so the price will in usd = 20*1.4 = 28

Note:- But when I get the price programmatically in custom.phtml file for USD store it shows GBP price

so how to get USD price.

7
  • Have you setup curreny conversation rate from admin? Commented Aug 23, 2018 at 6:34
  • yes it is working on product page but i want to get it in custom phtml file Commented Aug 23, 2018 at 6:46
  • In your custom file, you can get product price by magento way. So you get proper price. Commented Aug 23, 2018 at 6:55
  • share the code which you try to get product price on custom page. Commented Aug 23, 2018 at 6:56
  • $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $products = $objectManager->get('Magento\Framework\Registry')->registry('current_product'); $products->getPrice(); Commented Aug 23, 2018 at 6:59

1 Answer 1

0

You need to use code like this.

$OM = \Magento\Framework\App\ObjectManager::getInstance();
$priceHelper = $OM->create('Magento\Framework\Pricing\Helper\Data');
$productprice = $priceHelper->currency($products->getFinalPrice(), true, false);
echo $productprice;
1
  • If my answer help you, accept it, So it help other in community as well. Commented Aug 23, 2018 at 11:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.