cancel
Showing results for 
Search instead for 
Did you mean: 

Final price in different currency!

   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

Final price in different currency!

Hey guys,

I have different stores. for Eg US and UAE

i want the uae store final price to be shown in USD and in brackets AED

USD = USA

AED = UAE

 

for eg in final price its has to be like 100$ (367.32 AED )

Any solution would be really Helpful

thanks

2 REPLIES 2

Re: Final price in different currency!

Hello @amit_jacob ,


Need to do some customization with base price, where you want to display.

You can use convertPrice() with parameters.

 

 

public function convertPrice($amount = 0, $store = null, $currency = null)
{
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$priceCurrencyObject = $objectManager->get('Magento\Framework\Pricing\PriceCurrencyInterface'); //instance of PriceCurrencyInterface
$storeManager = $objectManager->get('Magento\Store\Model\StoreManagerInterface'); //instance of StoreManagerInterface
if ($store == null) {
$store = $storeManager->getStore()->getStoreId(); //get current store id if store id not get passed
}
$rate = $priceCurrencyObject->convert($amount, $store, $currency); //it return price according to current store from base currency

//If you want it in base currency then use:
$rate = $this->_priceCurrency->convert($amount, $store) / $amount;
$amount = $amount / $rate;

return $priceCurrencyObject->round($amount);//You can round off to it or you can return it in its original form
}

 

Here, $amount is the amount to which you want to convert.

$store is the store_id, from which store’s base currency you want to convert.

$currency is the currency to whom you want to convert, if you passed null then it takes current currency.

If my answer is useful, please Accept as Solution & give Kudos

Re: Final price in different currency!

Hello @amit_jacob 

Alternate solution,

You can set USD as the base currency, use currency switcher to convert the price of a store in AED. On checkout, it will automatically display You will be charged for XX USD like an image attached.

A suggestion is just if you don't want to do the code for this functionality.

 

m9CSW.png

Was my answer helpful? You can accept it as a solution.
200+ Premium Magento 2 Extensions Need help? Hire Magento Developer