Bug when opening checkout in Safari(Mac)

fileeefileee Member
in Bugs & Feature Requests edited March 17
Hey there,

Over the last days we were hunting down a weird bug in Safari on Mac (on windows it seems to work). The problem is that after putting something into the card, the cart is empty. But doing it again it works. There is also some SSO involved but the actual problem seems to appear before SSO is even triggered.

Let me attach you the description of our engineer:
-------------------------------------
To add an item to the cart, we are generating a parameter string which looks as follows.

cartParams = name=fileeeBox&image=https%3A%2F%2Fbox.fileee.com%2Fassets%2Fimages%2F31dba8b8.thumb-box.jpg&category=fileeeBox&price=16.764705882&parent_code=&code=fb1

Once we have the parameters, we are making a jsonp call to the cart. storedomain is properly set in FC.settings object.
FC.client
.request(FC.settings.storedomain + '/cart?' +cartParams)
.done((dataJSON) => {
});

In the jsonp cart callback, we are creating a new window object, and setting the location to checkout Window.location.href = FC.settings.storedomain + '/cart?cart=checkout';
This usually loads the cart in a new window. It is working perfectly fine in all browsers except safari (Mac).
The json returned by jsonp call to the cart (dataJSON variable in the above code) has the items that we passed to jsonp call in items property.

In the checkout window,
- when we logged window.FC variable and checked json property in it, the items property is an empty array.
- FC.session.sessionExists() is returning true
- FC.session.get() is returning a valid string with fcsid=

The issue happens only the first time we try to add anything to cart, repeating the steps again works fine in safari.

PS: foxycart is not redirecting the user to our server for authorization when this happens
To replicate the issue again, we had to clear history in safari and start safari.
-------------------------------------
Tagged:
Comments
  • fc_adamfc_adam FoxyCart Team
    @fileee,

    Thanks for providing all the details - that's very helpful. I believe what you're seeing is Safari isn't picking up the right session the first time around, so it's creating a new session which is an empty cart. To work around that - when you forward the customer to the cart, ensure that you're appending the fcsid session ID to that URL as well, something like this:
    Window.location.href = FC.settings.storedomain + '/cart?cart=checkout' + FC.session.get();
    Could you give that a try for us and see if it fixes the issue? If not - let us know and we'll be happy to take another look.
  • fileeefileee Member
    Good news, that was exactly the problem, now it works. Thank you!
Sign In or Register to comment.