Magento 2 : Currency change frontend eventChange Magento base and display currency (and auto-update the prices in backend, EUR -> RON)Product price suddenly reduces when adding product to quote via admin backend, if Magento contains multiple currenciesCurrency Symbol doesnt changeHow to change currency symbol OR add own currencyHow to get current currency symbol in multi-currencies magento 2magento 1.9 Create order programmatically in aed currency with aed rateMagento change quote currency programmaticallyMagento-2 How to convert price from current currency to base currencyMagento 2 - Product custom price not change based with current currencyMultiple currency not working with custom price quote - Magento 2

Does the 500 feet falling cap apply per fall, or per turn?

LocalDate.plus Incorrect Answer

Exception propagation: When to catch exceptions?

Is it a bad idea to replace pull-up resistors with hard pull-ups?

Is Simic Ascendancy triggered by Awakening of Vitu-Ghazi?

Can the sorting of a list be verified without comparing neighbors?

Control variables and other independent variables

What food production methods would allow a metropolis like New York to become self sufficient

Is there a faster way to calculate Abs[z]^2 numerically?

Increase height of laser cut design file for enclosure

Was there a contingency plan in place if Little Boy failed to detonate?

"Right on the tip of my tongue" meaning?

How are one-time password generators like Google Authenticator different from having two passwords?

Why use steam instead of just hot air?

What does i386 mean on macOS Mojave?

Can 'sudo apt-get remove [write]' destroy my Ubuntu?

What are the ramifications of setting ARITHABORT ON for all connections in SQL Server?

Was there ever any real use for a 6800-based Apple I?

Washer drain pipe overflow

Remove everything except csv file Bash Script

Is the schwa sound consistent?

Does Lawful Interception of 4G / the proposed 5G provide a back door for hackers as well?

Was this a power play by Daenerys?

Is it a Munchausen Number?



Magento 2 : Currency change frontend event


Change Magento base and display currency (and auto-update the prices in backend, EUR -> RON)Product price suddenly reduces when adding product to quote via admin backend, if Magento contains multiple currenciesCurrency Symbol doesnt changeHow to change currency symbol OR add own currencyHow to get current currency symbol in multi-currencies magento 2magento 1.9 Create order programmatically in aed currency with aed rateMagento change quote currency programmaticallyMagento-2 How to convert price from current currency to base currencyMagento 2 - Product custom price not change based with current currencyMultiple currency not working with custom price quote - Magento 2






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I want to update the quote item price on switching the currency from the frontend.



Is there any event to track currency switch option and give me the previous currency and requested currency?










share|improve this question
























  • create custom event reference: mageplaza.com/magento-2-module-development/…

    – Nikunj Vadariya
    Jun 23 '17 at 6:42

















0















I want to update the quote item price on switching the currency from the frontend.



Is there any event to track currency switch option and give me the previous currency and requested currency?










share|improve this question
























  • create custom event reference: mageplaza.com/magento-2-module-development/…

    – Nikunj Vadariya
    Jun 23 '17 at 6:42













0












0








0








I want to update the quote item price on switching the currency from the frontend.



Is there any event to track currency switch option and give me the previous currency and requested currency?










share|improve this question
















I want to update the quote item price on switching the currency from the frontend.



Is there any event to track currency switch option and give me the previous currency and requested currency?







magento2 frontend currency multicurrency






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jun 23 '17 at 6:22









Nikunj Vadariya

2,9261823




2,9261823










asked Jun 23 '17 at 6:21









Ashish JagnaniAshish Jagnani

4,64721957




4,64721957












  • create custom event reference: mageplaza.com/magento-2-module-development/…

    – Nikunj Vadariya
    Jun 23 '17 at 6:42

















  • create custom event reference: mageplaza.com/magento-2-module-development/…

    – Nikunj Vadariya
    Jun 23 '17 at 6:42
















create custom event reference: mageplaza.com/magento-2-module-development/…

– Nikunj Vadariya
Jun 23 '17 at 6:42





create custom event reference: mageplaza.com/magento-2-module-development/…

– Nikunj Vadariya
Jun 23 '17 at 6:42










1 Answer
1






active

oldest

votes


















1














I would recommend to write a Plugin on the following Controller Action :



MagentoDirectoryControllerCurrencySwitchAction



For example:



 <?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoDirectoryControllerCurrencySwitch">
<plugin name="yournamespace_yourmodule_directory_currency_switch_plugin"
type="YourNamespaceYourModulePluginMagentoDirecotryControllerCurrencySwitchAction"
sortOrder="10"
disabled="false"/>
</type>
</config>


And then you could use the following code:



 <?php


namespace YourNamespaceYourModulePluginMagentoDirectoryControllerCurrency;

class Switch


protected $storeManager;

public function __construct(
MagentoStoreModelStoreManagerInterface $storeManager
)
$this->storeManager= $storeManager;


public function beforeExecute(
MagentoDirectoryControllerCurrencySwitchAction $subject,
$result
)
$currentCurrency = $this->storeManager->getStore()->getCurrentCurrencyCode();
$newCurrency = (string)$this->getRequest()->getParam('currency');
// your code here








share|improve this answer

























  • I will check your answer and let you know.

    – Ashish Jagnani
    Jun 23 '17 at 9:36











  • @AshishJagnani did you resolved the issue?

    – Mr. Lewis
    Jun 27 '17 at 20:36











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f180423%2fmagento-2-currency-change-frontend-event%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














I would recommend to write a Plugin on the following Controller Action :



MagentoDirectoryControllerCurrencySwitchAction



For example:



 <?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoDirectoryControllerCurrencySwitch">
<plugin name="yournamespace_yourmodule_directory_currency_switch_plugin"
type="YourNamespaceYourModulePluginMagentoDirecotryControllerCurrencySwitchAction"
sortOrder="10"
disabled="false"/>
</type>
</config>


And then you could use the following code:



 <?php


namespace YourNamespaceYourModulePluginMagentoDirectoryControllerCurrency;

class Switch


protected $storeManager;

public function __construct(
MagentoStoreModelStoreManagerInterface $storeManager
)
$this->storeManager= $storeManager;


public function beforeExecute(
MagentoDirectoryControllerCurrencySwitchAction $subject,
$result
)
$currentCurrency = $this->storeManager->getStore()->getCurrentCurrencyCode();
$newCurrency = (string)$this->getRequest()->getParam('currency');
// your code here








share|improve this answer

























  • I will check your answer and let you know.

    – Ashish Jagnani
    Jun 23 '17 at 9:36











  • @AshishJagnani did you resolved the issue?

    – Mr. Lewis
    Jun 27 '17 at 20:36















1














I would recommend to write a Plugin on the following Controller Action :



MagentoDirectoryControllerCurrencySwitchAction



For example:



 <?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoDirectoryControllerCurrencySwitch">
<plugin name="yournamespace_yourmodule_directory_currency_switch_plugin"
type="YourNamespaceYourModulePluginMagentoDirecotryControllerCurrencySwitchAction"
sortOrder="10"
disabled="false"/>
</type>
</config>


And then you could use the following code:



 <?php


namespace YourNamespaceYourModulePluginMagentoDirectoryControllerCurrency;

class Switch


protected $storeManager;

public function __construct(
MagentoStoreModelStoreManagerInterface $storeManager
)
$this->storeManager= $storeManager;


public function beforeExecute(
MagentoDirectoryControllerCurrencySwitchAction $subject,
$result
)
$currentCurrency = $this->storeManager->getStore()->getCurrentCurrencyCode();
$newCurrency = (string)$this->getRequest()->getParam('currency');
// your code here








share|improve this answer

























  • I will check your answer and let you know.

    – Ashish Jagnani
    Jun 23 '17 at 9:36











  • @AshishJagnani did you resolved the issue?

    – Mr. Lewis
    Jun 27 '17 at 20:36













1












1








1







I would recommend to write a Plugin on the following Controller Action :



MagentoDirectoryControllerCurrencySwitchAction



For example:



 <?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoDirectoryControllerCurrencySwitch">
<plugin name="yournamespace_yourmodule_directory_currency_switch_plugin"
type="YourNamespaceYourModulePluginMagentoDirecotryControllerCurrencySwitchAction"
sortOrder="10"
disabled="false"/>
</type>
</config>


And then you could use the following code:



 <?php


namespace YourNamespaceYourModulePluginMagentoDirectoryControllerCurrency;

class Switch


protected $storeManager;

public function __construct(
MagentoStoreModelStoreManagerInterface $storeManager
)
$this->storeManager= $storeManager;


public function beforeExecute(
MagentoDirectoryControllerCurrencySwitchAction $subject,
$result
)
$currentCurrency = $this->storeManager->getStore()->getCurrentCurrencyCode();
$newCurrency = (string)$this->getRequest()->getParam('currency');
// your code here








share|improve this answer















I would recommend to write a Plugin on the following Controller Action :



MagentoDirectoryControllerCurrencySwitchAction



For example:



 <?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoDirectoryControllerCurrencySwitch">
<plugin name="yournamespace_yourmodule_directory_currency_switch_plugin"
type="YourNamespaceYourModulePluginMagentoDirecotryControllerCurrencySwitchAction"
sortOrder="10"
disabled="false"/>
</type>
</config>


And then you could use the following code:



 <?php


namespace YourNamespaceYourModulePluginMagentoDirectoryControllerCurrency;

class Switch


protected $storeManager;

public function __construct(
MagentoStoreModelStoreManagerInterface $storeManager
)
$this->storeManager= $storeManager;


public function beforeExecute(
MagentoDirectoryControllerCurrencySwitchAction $subject,
$result
)
$currentCurrency = $this->storeManager->getStore()->getCurrentCurrencyCode();
$newCurrency = (string)$this->getRequest()->getParam('currency');
// your code here









share|improve this answer














share|improve this answer



share|improve this answer








edited May 7 at 13:27









Divyesh Rana

84




84










answered Jun 23 '17 at 8:40









Mr. LewisMr. Lewis

1,310711




1,310711












  • I will check your answer and let you know.

    – Ashish Jagnani
    Jun 23 '17 at 9:36











  • @AshishJagnani did you resolved the issue?

    – Mr. Lewis
    Jun 27 '17 at 20:36

















  • I will check your answer and let you know.

    – Ashish Jagnani
    Jun 23 '17 at 9:36











  • @AshishJagnani did you resolved the issue?

    – Mr. Lewis
    Jun 27 '17 at 20:36
















I will check your answer and let you know.

– Ashish Jagnani
Jun 23 '17 at 9:36





I will check your answer and let you know.

– Ashish Jagnani
Jun 23 '17 at 9:36













@AshishJagnani did you resolved the issue?

– Mr. Lewis
Jun 27 '17 at 20:36





@AshishJagnani did you resolved the issue?

– Mr. Lewis
Jun 27 '17 at 20:36

















draft saved

draft discarded
















































Thanks for contributing an answer to Magento Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f180423%2fmagento-2-currency-change-frontend-event%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form