Create Rate on Categories Discount via API

We currently create discounts using a percentage of the total of the order via API. This is provided automatically when someone signs up to our mailing list. We have just added a Gift Vouchers as a new product which again will create a discount using a fixed dollar amount via another API call.

The problem is if someone adds the Gift Voucher product to their order and then applies the percentage on total order code then the Gift Voucher has that saving applied to it too, this is not good.

My initial solution was to modify the Rate discount to only be applied to products of particular categories of which the Gift Voucher product category would not be included. This is not the ideal way as we have 56 categories for all other products we want the Rate discount to be applied to. It would be better to exclude specific categories in our particular situation. However, we can do create this type of discount via the Snipcart dashboard but the API documentation does not provide specifications on applying this particular type of discount.

Can I create this type of discount and send the list of categories that this discount should be applied to?

If someone else has an alternative solution to my situation I would be appreciative of your advice. :slight_smile:

Hi @charles I was hoping that you might be able to provide some insight in to this issue that I’m experiencing? We have Gift Voucher products that we would like to launch but can’t just yet until we get all other discounts to ignoring this one product.

Hi there,

The discounts can be applied to the whole order or scoped to either a list of product ids or categories. If I understand your situation correctly, your initial solution would be the quickest way to achieve your goal: Scope the discount rate to all categories excluding discounts

@dominic Yes, that is my preferred option. What I want to know is can I do this via the API? I noticed that there is no documentation for this type of request in the API documentation.

Okay, So I did not get much support here so I just used Postman to do a few tests to see what errors I got back from my API requests. After a few tries, I found the required parameters and have been able to create the discounts based on Rate by Catagory. It would be nice if Snipcart replied to support requests and kept their API documentation up to date. :frowning:

@AndyKnz Thank you for pointing that out. We have updated the documentation and included the RateOnCategory and RateOnItems discount types.