# Give discount % based on products category and quantity in cart

I am planning to give the below offer. Buy 1 product from X category and 1 product from another category and get 15% off.

I set my cart rules like below both condition and action.

It is working perfectly when there is 1 product from X category and 1 product from Y category but the problem is when there are 2 products from X category and 1 product on Y category it is still calculating 15% discount on total 2*X+1*Y instead of only applying to 1*X+1*Y and bill the other 1*X fully. How to set this condition?

Found the exact scope looking for

Go to "cart price rule"

Step 1

1- Create new rule (Add required values and status as active)

2- Go to "Conditions" choose "Products Subselection" > mention quantity as "equal to greater than (XX)" (in my Case value is "30")

3- Add "Category is (X)" (in my case id is "3") Step 2

Go to "Actions"

1- Select "Percent of product price"

2- Add "Discount Amount : (X)" (in my case 5%)

3- Go to "Apply the rule only to cart items matching the following conditions (leave blank for all items)."

4- In Drop down choose "SKU"

Select Required SKU's of Same category

Click Save

First Rule is applied.

Duplicate Above Rule Go to "Conditions" change the quantity as "equal to greater than (XX)" (in my Case value is "60") Change ""Discount Amount : (X)" (in my case 10%) Enable Discard Subsequent Rule and Save. both Rules are applied

Unfortunately in my Case 2nd rule is not discarding the rule 1. so i have done some mathematics and use "5.263%" instead of 10% in Actions > Discount Amount.

Its working perfect. If any one can help me in Unfortunate please advise.

Conclusion:

1- I have added multiple products from all categories in store (i.e. 60 Products from other 10 Categories in store) and 29 Units of different SKU's from Category Id 3. Discount Was not applied. When increased any of SKU from category id 3 to +1 (29+1) and updated cart. 5% discount was applied till adding 59 No. of units of Different SKU's from Specified Category.

Discount value was only applied to the total value of 30 Units (Explanation: Discount was not applied to the whole cart)

2- When No of units reached 60+ Discount changed to 10%.