In Magento, I have some products, which can be purchased only once by a customer, and this products can be purchased alone not combined with any products.

Eg. 1) If the Product X purchased by a customer C, then when the customer C again try to purchase the product X , it should not allow him to purchase.

2) The Product X, can be purchased alone only, when the customer add the Product X to cart, then it needs to check whether already any products are in cart,

  • if no, then this product can add to cart
  • if yes, then this product should not add to the cart, need to show some notification and need to redirect to product page.

any ideas?

thanks in advance.

closed as too broad by Amit Bera, 7ochem, Marius May 4 '15 at 7:17

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Explain why you need this, what type of product so we understand what it is about. – SPRBRN Mar 7 '14 at 9:37
  • This Product is about some thing like membership, so if a user already membership should not be again to pay for it. – Helphin Mar 10 '14 at 5:13
  • Do you allow guest checkouts? Do you force people to log in before they can place items into the cart? – Kristof at Fooman Mar 11 '14 at 23:00
  • guest checkout not allowed to this product. – Helphin Mar 12 '14 at 4:50
  • The customer no need to log in to add this product to cart – Helphin Mar 12 '14 at 5:11

For situation 1 it's easy. Add a new product for each X to the catalog. Set stock to 1, and don't allow backorders. We do this as well for one type of product which is handmade and has different specs for each item.

I don't know why you would want to have situation 2. Is this a shop where you can only order 1 thing at a time? What will customers prevent from making another order?

  • if i setting stock as 1, then if a customer buy this product then this product will be in out of stock so other customer can't able to purchase. i wants to sell this product for unique customer – Helphin Mar 7 '14 at 5:08

I suggest that you will need to create an extension with an observer that watches for the quote_totals, something like the following: http://www.blog.magepsycho.com/tag/event-observer/

You will be able to check against your conditions in the observer, dealing with it as you have to.

Another option would be to do it at the template and/or block level.

Checking against the conditions there may be easier, but this would not be as future-proof.

Not the answer you're looking for? Browse other questions tagged or ask your own question.