last day (14 days later) » 

10:40 AM
0
A: jQuery remove first two specific items from total price

EdenSourceIs this something like this that you are needing ? var retailPrice = 0; var testerPrice =0; $("input").on("change", function () { var sum = 0; if ($(this).attr('id') == 'retail') { var qty = $(this).val(); if (qty == (6 * Math.floor(qty / 6))) { ...

 
Thank you! the offered free testers are good, the amount of 'freeTesterQty' should not be included in the end price.
p.s. It's possible there are more test products in the list, this makes it complexer in the calculation
 
freeTesterQty isn't included in the end price, you can do a manual sum to see that : for 5 products, price is 82.5€ (5*16.50), and for 6 products, and 1 free tester, price is 99€ (6*16.50).
See "update 1" in my answer for more products solution
 
I am sorry, I updated the jsfiddler to give a better impression. jsfiddle.net/b8u4xrbf/6 there is not just one test product to choose from.
 
New update in the answer ;)
 
Almost! Now just the only thing needs to be done is to exclude the 'free' chosen products from the end price.
 
10:41 AM
Free products aren't summerized in end price, see my first comment.
 
11:13 AM
Hee EdenSource!
As response on your last update
When I set the value's for product 1 and 2 both at 3
I get the price of 99,-
and 1 tester for free
perfect.
When I take 1 tester, the prices changes to 107.5 euro.
it supposed still to be on 99,- euro in this case
 

last day (14 days later) »