This isn't a lot different to the last post that did some cookie modification for handling product page shipping costs. What we'll do here is to create a cookie with a token value that is attached to the customer. So when the customer logs in from another device that specific cart token is used and gives us a persistent cart (sort of).
There's a pile of blog posts that I've smashed out recently given that I've had many hours stuck on planes without wifi. This is one of those, but a real live example using this code is yet to come. Soon. I'm thinking I'll just wrap it up in a naked Shopify theme so the only code relates to this (so no css, other js, etc)
Now before you add the code to everything you have to be aware that this is just an idea. Like a lot of the posts I make here I've not dug into the possible drawbacks.
One such drawback is that Shopify will use a new cart cookie value everything the page refreshes until it has items within it. That poses a problem when you add the example code in as is. Ugh. I'm working on a more stable script but for now you should hold off just copy and pasting any thing here.
It's still a fun learning exercise to see how you can stretch the platform. If you've got feedback on issues experienced I'd love to here them.
The Code (aka: the good stuff)
Either copy the code from the block below or grab it from the Shopify Code Snippets repo.
grabbing the Liquid JS code...