Post by radi8tor » Mon Feb 25, 2019 10:30 pm

Hi,

Is there a way to remove/disable currency cookie in Opencart because my store has only 1 currency and this is obsolete?

Thanks!

OC version: 3.0.2.0
Theme made by: Zemez.io
Last edited by radi8tor on Fri Mar 01, 2019 1:33 am, edited 1 time in total.

New member

Posts

Joined
Thu Feb 01, 2018 6:21 pm

Post by straightlight » Mon Feb 25, 2019 11:22 pm

Not sure what you mean by obsolete but it shouldn't do any difference whether it's one currency or multiple currencies being tracked on a store …

In your catalog/controller/startup/startup.php file,

find:

Code: Select all

if (!isset($this->request->cookie['currency']) || $this->request->cookie['currency'] != $code) {
replace with:

Code: Select all

if (!isset($this->request->cookie['currency']) || (($this->request->cookie['currency'] != $code) && sizeof($currencies) > 1)) {
This should provide what you need but I don't see the purpose on this one.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by paulfeakins » Tue Feb 26, 2019 7:02 pm

radi8tor wrote:
Mon Feb 25, 2019 10:30 pm
Is there a way to remove/disable currency cookie in Opencart
Why?

For quick, professional OpenCart support please email info@antropy.co.uk


User avatar
Expert Member

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - Reigate, Surrey, United Kingdom

Post by Johnathan » Tue Feb 26, 2019 9:47 pm

I just want to add in that some parts of OpenCart --- and certainly some extensions --- rely on that cookie, so removing it may cause you issues. You're safer to just leave it alone, but if it matters to you a lot, straightlight's edit should work to make sure it's not set when first loading the store.

Image
Image Image Image Image


User avatar
Global Moderator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by radi8tor » Fri Mar 01, 2019 1:33 am

Thanks everybody for your input on this. I will consider not to remove the currency cookie.

New member

Posts

Joined
Thu Feb 01, 2018 6:21 pm

Post by webtrekker » Sat Feb 15, 2020 12:35 am

I,too, find this currency cookie annoying. I have my default currency set to GBP but it always displays USD in my shop. Most posts I've read suggest deleting the cookie and then it will reset itself when the site is loaded again. That's fine, but ........................ the latest versions of Firefox don't allow you to delete a single cookie, the only option available is to delete ALL cookies for that domain, which means a lot of time wasted logging back into non-OpenCart related parts of your site.

Newbie

Posts

Joined
Fri Feb 14, 2020 7:11 pm

Post by letxobnav » Sat Feb 15, 2020 1:27 pm

currency is set just like language in order:

language:
1) if it it set in the session
2) if it is set in the cookie
3) language based on browser accept, if you support those languages
4) your default language


currency:
1) if it it set in the session
2) if it is set in the cookie
3) your default currency

when changing language or currencies, it is set in the session and the cookie.

if your browser displays USD while your default currency is GBP, then you have set that USD currency when last visiting your site as that would be in the cookie.
or you have some extension which changes the default currency based on language or ip.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Active Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan
Who is online

Users browsing this forum: No registered users and 38 guests