Ask a Jedi: Sharing a shopping cart between multiple (related) sites

Brian asked:

We are attempting to have a shopping cart that is shared over multiple domains(,, So far I haven't been able to share variables. Not sure what there is to do and was looking to see if you have something that can at least give me a nudge in the right direction. Thanks in advance.

I can think of a few ways to work around this, but let me propose one and see how badly the idea gets torn apart by my readers (and yes, that’s an invitation, please share your ideas!). I spoke with Brian and confirmed that even though the sites are unique, they are all one machine. (Technically multiple machines in a cluster, but for all intents and purposes, one machine.) Given that they all share the same network, I think you can look at a solution that uses one database as the primary holder of the cart. So let’s assume we have three sites:

  • </ul> (Note - I have no idea what those sites may actually be in real life. If you visit them and discover some new level of perversity heretofore unknown to you... sorry.) Now let's assume we have one unique way of identifying you on all three sites. Most likely this would be an email address. Given that I'm no matter where I'm at on the Internet, we could use my email address on all three sites as a way to uniquely identify me. Given the assumptions so far, all three sites could query one database to fetch cart records for the email address. This would allow adding, editing, viewing, etc all to occur and "just" work across all three sites, again assuming that you are logged in. Even if not logged in, if you shop on, pop over to beta and then log in, it should be able to restore your cart. I think this will work fine. There are some caveats of course. I can go to and register as someone else's email address. If you don't do a followup email verification, then you will never know that on alpha is not the same as in beta. It's also possible that folks may simply stop using an address. may be let go. The new may then go register on I think though in that case you would want to use the same login system across all sites. That way you could also use the existing email address if you had the password. It would be annoying to the new guy, but at worse he can use an alternate email address. Any thoughts on this technique?
Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate for Extend by Auth0. He focuses on serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support.

Lafayette, LA