Quantity Based Discount on Wix

I need to write an API which helps me to set a promotion based on the number of pieces added to a cart from a specific product.

I tried using AddProducttoCart() in combination with If Else statement passing quantity and product as conditions but it’s not really working.

Can anyone please suggest the correct code?

You can’t do it currently, see the request below, vote for it and do the workaround on the same page.

https://support.wix.com/en/article/request-offering-quantity-based-discounts-in-wix-stores

Currently, it is not possible to offer quantity based discounts in Wix Stores (e.g., if you buy 10 shirts, you get a 20% discount on the total price). As a workaround solution, you can create a product option for a quantity of items and set a different price.

I need the same… I sell Kombucha, there are 12 different flavors and we offer discounts on 3 bottles and 6 bottles, but the discount only applies when you buy the same flavor. I would like it, so when a customer adds 3 different flavors or 6 different flavors the discount then applies…
Currently a customer buys 1 x Black tea, 1 x Green tea and 1 x Oolong tea there is no discount… However if they buy 3 x Black tea they get a discount.