You don't need cookies for a persistent shopping basket. If I want a persistent shopping basket, give me the option to create an account and store my shopping basket for later use. Otherwise, just nuke my shopping basket when my session cookie expires. This is a non-issue.
Of course it's not visitors who want persistent shopping baskets. It's sellers. And I don't really care about what they want. On ~100% of the websites I visit, I'm the visitor, not the seller. And given that webshops were a thing before persistent shopping baskets were a thing, I'll wager they can do without.
Logging into an account requires some kind of persistent identifier. And it is not just for shopping carts - you also have a login and cookie here on Hacker News.
Cookies were introduced as a hack to allow sessions. When HTTP/2 was being proposed phk raised this issue and asked why they didn't use this as an opportunity to make real fixes to http warts like this and eliminate cookies[1]. But given that it was pushed by Google, which didn't mind them, this of course was ignored.
> Of course it's not visitors who want persistent shopping baskets. It's sellers.
That’s not so simple. Persistent shopping baskets create problems for sellers e.g. stock changes; price changes; products may become obsolete. Some of them let the cart expire at some point, even down to a couple hours for some (ASOS). As a visitor I do want a persistent cart accross sessions because I may need some time to make (nor not) my purchase. And no, I won’t give you my email just for that.
I run a game where you can play without creating an account, and going back to the game later will take you back to your previous state. How would I manage this without cookies? A lot of people don't want to create an account.
I assume that whatever fate befalls cookies will happen to localStorage as well. But maybe not. localStorage is kind of better for this purpose in any case.
The state is saved on a server. I only need an identifier to retrieve the state but sure, I could use localStorage instead for saving the identifier. What's the difference though?
Of course it's not visitors who want persistent shopping baskets. It's sellers. And I don't really care about what they want. On ~100% of the websites I visit, I'm the visitor, not the seller. And given that webshops were a thing before persistent shopping baskets were a thing, I'll wager they can do without.