5

I received a report from a user today that users in Chrome cannot add items to their cart. It seems to be a new problem only in the past few days, perhaps caused by a recent Chrome update.

I later discovered that this is only a chrome problem, and doesn't actually affect Firefox users at all.

Basically, in Chrome, the user clicks the add to cart button, the site redirects to the cart, and the cart is empty.

When I inspected the HTTP requests for both Chrome and Firefox, I noticed that in Firefox, the exp_cartthrob_session_id cookie is maintained throughout the session. In Chrome, it seems to be reset on each request. Basically each request (GET product details page, POST add to cart, GET cart page) comes with a separate header that looks like:

Set-Cookie:exp_cartthrob_session_id=abcdefghijklmnopqrstuvwxyz; expires=Wed, 03-Sep-2014 03:17:59 GMT; Max-Age=18000; path=/

Why would Cartthrob be resetting the session header on every request. Is this a bug with Chrome expiring cookies, or a bug with Cartthrob? How can I get "add to cart" working again on my site?

1 Answer 1

6

I discovered the problem. We were using CartThrob's fingerprinting for sessions with the configuration set to "0" for the default fingerprinting method. The default method creates the fingerprint as:

$fingerprint = $this->EE->input->server('HTTP_ACCEPT_LANGUAGE').$this->EE->input->server('HTTP_ACCEPT_CHARSET').$this->EE->input->server('HTTP_ACCEPT_ENCODING');

In Chrome, the HTTP_ACCEPT_ENCODING header is different between GET and POST requests, which made CartThrob reset the session on POST requests from Chrome.

The problem was fixed by disabling session fingerprinting in the CartThrob settings.

4
  • We discovered this problem today also when using the Cart Throb "Multi Add To Cart Form" only. Was you using this? We suspected it was the sessions (Removing them from the DB fixed it, but only for a split second) but changing it to disable fingerprinting fixed this issue.
    – Jason Mayo
    Sep 4, 2014 at 10:41
  • We are using the "Multi Add To Cart Form". I haven't tested using the single form although I'm pretty sure it would happen on any POST request when using fingerprinting, no matter the source.
    – Travis
    Sep 4, 2014 at 14:38
  • I am using an older version and there is no settings for this. What should I do then?
    – Abhi
    Oct 6, 2014 at 12:06
  • I had a client that experienced this as well. Anyone have any idea how long that issue might have been in play? The problem did seem limited to Chrome. Nov 21, 2014 at 16:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.