I believe the cart itself can not limit to only 1 item . Nevertheless, your front end javascript can.
Add some logic using a JS Cookie
The following has to be done after snipcart is loaded NOT on document ready
document.addEventListener(‘snipcart.ready’, () => {
// This is called AFTER item is added.
Snipcart.events.on('item.added', (parsedCartItem) => {
Cookies.set('block', true);
});
}
Then disable
the button which blocks uses from clicking. The following can be done on the usual doc loaded.
document.addEventListener(“DOMContentLoaded”, () => {
addEventListenerById('add-item-button', 'click', function(evt) {
if (Cookie.get('block') == true) {
evt.target.disabled = true;
// or this.disabled = true
}
});
}
And then remove the cookie so the user can come back after the session. Or set an expiry.
It may have errors but thats the gist.