Page 1 of 1

[SOLVED] how to remove currency cookie if store has only 1 currency?

Posted: Mon Feb 25, 2019 10:30 pm
by radi8tor
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

Re: how to remove currency cookie if store has only 1 currency?

Posted: Mon Feb 25, 2019 11:22 pm
by straightlight
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.

Re: how to remove currency cookie if store has only 1 currency?

Posted: Tue Feb 26, 2019 7:02 pm
by paulfeakins
radi8tor wrote:
Mon Feb 25, 2019 10:30 pm
Is there a way to remove/disable currency cookie in Opencart
Why?

Re: how to remove currency cookie if store has only 1 currency?

Posted: Tue Feb 26, 2019 9:47 pm
by Johnathan
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.

Re: how to remove currency cookie if store has only 1 currency?

Posted: Fri Mar 01, 2019 1:33 am
by radi8tor
Thanks everybody for your input on this. I will consider not to remove the currency cookie.