Menu Close
    Hire us Request quote Reading list Switch to dark mode

    Price conversion from one currency to another

    Here is how you can convert the price from one currency to another.

    First of all, in the Constructor, create an instance of  “\Magento\Directory\Model\Currency” as below:

    then you can use the following function to get the updated price in the new currency.

    here, $price is the amount that you want to convert, $currCodeFrom is the currency code from which the price has to be converted, and $currCodeTo is the currency Code in which you want the converted price.

    I have used this code in a helper, you can use this in Block or a Controller as per your need.

    For any queries, feel free to comment below. 🙂

    . . .

    Comment

    Add Your Comment

    Be the first to comment.

    Back to Top
    css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just received your message and our expert will get back to you shortly.
    Send Again
    Close