Reputation: 21
So our store basically sells 6month and annual subscriptions to our businesses website. I was wondering if there was a way to make it so that they can only add one subscription (product) to the cart, not multiples, so customers dont make the mistake of buying double subscriptions?
Upvotes: 2
Views: 2749
Reputation: 17656
To limit only one item per order
Create a custom module with a observer to disallow adding items if the cart already has quantity (see getItemsQty()). You should also be aware of updateItem() which could be used to change the quantity of items in one's cart
checkout_cart_update_items_after
checkout_cart_product_add_after
checkout_cart_add_product_complete
checkout_cart_update_item_complete
checkout_cart_save_before
checkout_cart_save_after
See - Magento - Adding multiple products to cart programatically
To limit one of each product per order
You can limit the maximum quantity of a product that can be added to your shopping cart by editing the value on the Inventory tab when in product admin.
See Magento: limit product max quantity to 1 per order. quantity 2 = 2 orders
Upvotes: 1