How to display at checkout a free case for every 5 cases ordered

davidzupecdavidzupec Member
in Help edited May 2014
Hello I'm in the process of building the shopping page for my client. They want to offer a free case for every 5 cases ordered. So lets say the customer inputs 10 cases and clicks Add to Cart. On the checkout page then would show 12 cases (10 cases plus 2 free) and the total price would just be then for 10 cases. Is that possible?
  • Sorry I was referring to the pop-up cart page.
  • fc_adamfc_adam FoxyCart Team

    It is - but requires some custom javascript. There are two parts to it.

    Firstly, you'd need to add a discount to the product - by the sounds of it a product-level discount would work fine, and based on what you've described there it would be a "discount by a percentage based on the quantity" and a discount string of "repeat|6-100". That discount will discount every 6th product by 100%.

    Then, on your cart template (set in the FC administration), you'd add in some logic which loops through the cart. If a product is present that is a part of this promotion, and it has a quantity that is divisible by 5, you would then adjust the quantity field for the product within the cart to add in the necessary free products they can receive. Then once you've done that, you would finish off by calling "fc_TestCheckout()" which would see that the quantity input has changed, and force the customer to update. You could also display a little message to the customer to let them know that they qualify for free products and to update their cart to see them.
  • Hi adam, is there anyone you could recommend that I could get in touch with for help on this? thank you!
  • fc_adamfc_adam FoxyCart Team

    I'll whisper you some recommended developers that could help with this.
  • Hi Adam, thanks for the recommendations. I thought I'd give it a shot first : ) I thought it out differently and wanted it to be if the customers purchase 6 cases then in their cart would show a quantity of 6 but that 6th one would be discounted at 100%. So I had put in this code but for some reason it's still not correct: <input type="hidden" name="discount_quantity_percentage" value="Every 6 cases ordered gets you one free{repeat|6-100}" />
  • Sorry, it works in the format above! Just displays a little different than what I was expecting : )
  • Hi Adam, I just discovered that this code <input type="hidden" name="discount_quantity_percentage" value="Every 6 cases ordered gets you one free{repeat|6-100}" /> only gives the discount if I order 6 cases of the same product. It doesn't give me the discount if I order 3 of one product and 3 of another.

    How would I accomplish that?
  • fc_adamfc_adam FoxyCart Team

    Yeah - product level discounts only apply to those specific products individually. If you're wanting to apply a discount to multiple products, you'll need to set it up either as a category discount (if those products share a common category) or as a coupon which can apply to many different categories.
  • Hi Adam, gotcha I see! Yeah all the products use the same category. Thank you!
Sign In or Register to comment.