coupon code

ahsodesignsahsodesigns Member
in Help edited November 2013
I've read the wiki and just want to make sure I'm doing this right.
I need a discount code for 1 free product - the most expensive one in the cart. My products are $1.99, 2.99, 3.99, 5.99, and 7.99. So if the user puts a 7.99 in the cart, they get that item for free if they also have a 1.99 item. Is this possible?
If not, can I have a coupon code that will give the user one item in the shopping cart for free?
  • winstonwinston FoxyCart Team

    That's not really possible with our built in coupons, instead, you'd probably want to add some custom javascript that automatically adds a discount based on the product with the highest price. The coupon itself would have no discount, the discount would only be added by the javascript. To actually add the discount to the product, you'd need to remove and add the product with the discount input. It's not exactly straightforward, but it's possible. See here for how to add/remove products with our JSON api:

    There's some snippets on our code snippets page that will take care of the product looping. Check those snippets here:
Sign In or Register to comment.