Hi
I am building a shopping cart which is more or less complete but I am having difficulty trying to create a function to amend quantities. It should be a basic function but I'm not sure on the best way to do it.
I am trying to code a function where before submitting the cart to paypal, I want to check for quantities of an item so 2 items are free for every 12 items they buy.
For example:
Buy 1-10 items at £1 each
Buy 12 items and they they get 2 free. ie, qty is 12 but they pay £10. If they buy 14 items then they pay £12 as 2 are free if they spend more than £10 (they won't get 2 free if they only choose 10 items).
If they buy 24 items - they pay £20 (4 free).
If they buy 36 items - they pay £30 (6 free).
If they buy 38 items - they pay £32 (6 free + 2 @ £1).
So basically they get 2 items free for every 12 they buy.
My coding is not brilliant but any help to code a function to pass in qty and amount values and update amounts would be great.
Thank you any help offered.
I am building a shopping cart which is more or less complete but I am having difficulty trying to create a function to amend quantities. It should be a basic function but I'm not sure on the best way to do it.
I am trying to code a function where before submitting the cart to paypal, I want to check for quantities of an item so 2 items are free for every 12 items they buy.
For example:
Buy 1-10 items at £1 each
Buy 12 items and they they get 2 free. ie, qty is 12 but they pay £10. If they buy 14 items then they pay £12 as 2 are free if they spend more than £10 (they won't get 2 free if they only choose 10 items).
If they buy 24 items - they pay £20 (4 free).
If they buy 36 items - they pay £30 (6 free).
If they buy 38 items - they pay £32 (6 free + 2 @ £1).
So basically they get 2 items free for every 12 they buy.
My coding is not brilliant but any help to code a function to pass in qty and amount values and update amounts would be great.
Thank you any help offered.