Force 1 product per cart and quantity to one
Hello,
i'm trying to add a rule to my drupal commerce install. i need to force 1 product per cart, with max quantity = 1.
I tried:
Event: Before adding a product to the cart
Conditions : Elements: Total product quantity comparison Parameter: Order: [commerce_order] => Quantity >=1
and that's working smoothly.
But i can't find a rule to deny adding product to the cart. Already tried
Set a data value:
Selected data: commerce-order:commerce-line-items:1:quantity = 0
but it is not working. Just
Remove all products from an order
Parameter: Order to empty: [commerce_order]
works, but i'd like to remove the second product added, not the first one :)
thanks!

Comments
Hi, you can create a rule to
Hi, you can create a rule to empty the cart before adding a product, moreover you can disable the qty field on cart and on the product page.
The rule I'm using is:
{ "rules_empty_cart" : {"LABEL" : "Empty cart",
"PLUGIN" : "reaction rule",
"REQUIRES" : [ "commerce_cart" ],
"ON" : [ "commerce_cart_product_prepare" ],
"DO" : [
{ "commerce_cart_empty" : { "commerce_order" : [ "commerce_order" ] } }
]
}
}