There is a problem with this piece of code in the shopify javascript SDK
const cartID = localStorage.getItem('checkoutId');
if( cartID == null || cartID == ""){
client.checkout.create().then((checkout) => {
localStorage.setItem('checkoutId', checkout.id); // Store the ID in localStorage
});
}
Well there is not a problem with the code itself but with this way of treating the code. It seems that when "X" time passes the checkout ID is no longer working or available so the checkout that once existed, no longer exists. This resulted in an unusable ecommerce website since there was no checkout and the code always tried to access it.
I found out this was the problem since the Chrome browser returned an error stating that no checkout was found ( I do not posses that exact words ). I fixed this clearing the browser data, so the question is :
How do I state in the code to create a new checkout, saved it in local storage, and create a new checkout in 10 days, in order to avoid this from happening again.