You can add restrict cart for single seller functionality in your store. After adding this feature, the users can only add those items to a cart that are from a single seller. StoreHippo provides the startup widgets feature. Startup widgets contain logic to add
Suppose you want that the customers can only add products from one seller to the cart.
To restrict cart for a single seller, follow the steps mentioned below:
ms.app.addPrehook({entity: 'ms.carts', command: 'addItem'}, function(req, res, next) {
if(!(ms.cart && ms.cart.items && ms.cart.items.length)) return next()
var checkseller = true;
ms.cart.items.forEach(function(item){
if(checkseller && item.seller != req.data.seller_id){
checkseller = false;
alert("Only one seller items can be purchased at a time")
return res.error(406 ,"Only one seller items can be purchased at a time");
}
})
if(checkseller) next()
})
Now, the user will be allowed to add items from the single seller only. If the user tries to add an item from the other seller, the popup opens up notifying about the restriction.