Magento 2 Module:PHP code to get the currency code from Magento 2 website URL
Budget: $10 – $30 USD
we have wrote a custom Magento 2 module to switch the currency programmatically (references see the follows), it works well.
https://stackoverflow.com/questions/63718355/magento-2-default-currency-based-on-country
https://magento.stackexchange.com/questions/194987/switch-to-currency-in-magento-2-programmatically
The currency in our custom M2 module is a constant, we define it like:
$currency = 'SGD';
Screenshot see:
https://prnt.sc/FojPmZyhqTpS
We looking for someone to modify the php code, so that the module can get the currency from website URL,
for example:
if the URL like https://t1.mydesignlist.com/custom-phone-cases.html?p1=v1¤cy=CAD&p3=v3, then the currency is CAD
if the URL like https://t1.mydesignlist.com/custom-phone-cases.html?currency=SGD, then the currency is SGD
if the URL like https://t1.mydesignlist.com/custom-phone-cases.html, then set $currency to null
https://prnt.sc/PW9k0tDMjuFZ
Here are some references:
https://magento.stackexchange.com/questions/154134/magento-2-get-parameters-in-the-url
https://magefan.com/blog/get-current-url-magento-2
https://stackoverflow.com/questions/19211647/how-to-get-a-url-parameter-in-magento-controller
We will send our custom M2 module to you after we awarded this project to you.
Using the object manager directly is not allowed.
https://stackoverflow.com/questions/63718355/magento-2-default-currency-based-on-country
https://magento.stackexchange.com/questions/194987/switch-to-currency-in-magento-2-programmatically
The currency in our custom M2 module is a constant, we define it like:
$currency = 'SGD';
Screenshot see:
https://prnt.sc/FojPmZyhqTpS
We looking for someone to modify the php code, so that the module can get the currency from website URL,
for example:
if the URL like https://t1.mydesignlist.com/custom-phone-cases.html?p1=v1¤cy=CAD&p3=v3, then the currency is CAD
if the URL like https://t1.mydesignlist.com/custom-phone-cases.html?currency=SGD, then the currency is SGD
if the URL like https://t1.mydesignlist.com/custom-phone-cases.html, then set $currency to null
https://prnt.sc/PW9k0tDMjuFZ
Here are some references:
https://magento.stackexchange.com/questions/154134/magento-2-get-parameters-in-the-url
https://magefan.com/blog/get-current-url-magento-2
https://stackoverflow.com/questions/19211647/how-to-get-a-url-parameter-in-magento-controller
We will send our custom M2 module to you after we awarded this project to you.
Using the object manager directly is not allowed.