• Resolved philsafc

    (@philsafc)


    Hi

    How can I create a pricing calculator or slider where the number of items purchased affects the price in the following way.

    For example:

    I want to sell apples at £2 each if a customer buys 1-20 apples.

    If they buy 21-50 apples I want to charge them £2 for the first 20 and then £1.75 each for the rest.

    If they buy 51 to 100 apples I want to charge them £2 for the first 20, £1.75 for the numbers 21-50 and then £1.50 for apples 51-100.

    Example total if they buy 100 = (20×2) + (30*1.75) + (50*1.50)

    • This topic was modified 3 years, 5 months ago by philsafc.
Viewing 1 replies (of 1 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @philsafc

    The process is really simple. Assuming the fieldname1 is the number or slider field for the quantity, the equation’s code would be:

    
    MIN(fieldname1,20)*2+MAX(MIN(50,fieldname1)-20, 0)*1.75+MAX(fieldname1-50,0)*1.5
    

    And if you want the result with two decimal places:

    
    PREC(MIN(fieldname1,20)*2+MAX(MIN(50,fieldname1)-20, 0)*1.75+MAX(fieldname1-50,0)*1.5, 2)
    

    Best regards.

Viewing 1 replies (of 1 total)
  • The topic ‘Price Calculator varying quantity’ is closed to new replies.