1

In my website I would like to limit product quantity to 1, meaning is that user can order only one of a product in one order. And my question is how to configure to set maximum quantity to 1 . Any suggestion is greatly appreciated.

Thanks.

1

You can achieve this using Rules by following steps given below:

Event: After udpdating an already existing line item

Conditions: 1/ data comparison: commerce-line-item:type = product 2/ data comparison: commerce-line-item:commerce-product:type = Your given product type 3/ data comparison: commerce-line-item:quantity is greater than 1

Action: - set data value: commerce-line-item:quantity 1 - display custom message

Reference: https://drupalcommerce.org/questions/8066/how-limit-maximum-quantity-1-one-given-product-type

| improve this answer | |
  • - display custom message does not find in action, I am stuck on -display custom message. thanks – SAWAUNG Apr 6 '15 at 7:30
  • Its under System as Show a message on the site – Vishal Patil Apr 6 '15 at 7:37
1

I found this link, it is very simple. http://bonify.io/blog/2014/09/limit-quantity-when-adding-product-cart

  1. Events
    • Before saving a commerce line item
  2. condition

    • Entity is of bundle

      data selector: commerce-line-item, value: product

    • Data comparison

      Data to compare : commerce-line-item:commerce-product:product-id, operator: equal, Value:1

  3. Action

    • set a data value

      data: commerce-line-item:quantity, value: 1

    • Save Entity

      Data selector: commerce-line-item,

    • Show a message on the site

      Message: This product only available for 1., Value: warning

| improve this answer | |
  • 1
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – bummi Apr 6 '15 at 8:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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