Qty-based discounts (amount and percent)

home page
std.css

This will allow you to establish quantity-based discounts on specific items sent to PayPal. Each item has its own discount structure that you must set up, and the discount table does not exist beyond any item.. Cart-wide discounts (4 of one item, or 2 of 2 different items) simply require your own shopping cart. The reason is in the next paragraph.

The most important thing to understand when considering discounts is that the customer may change the quantity of items ordered once he is within the PayPal shopping cart, and there is no way for you to detect this.

Because of this we have to play a little game. Every order must be considered a single package of n items. So PayPal reports a quantity of 1, but we modify the description to report a package of n items. And we must calculate the qty * price for the total price of the package. See how it works before you judge too harshly. This is really the only way to do it properly.

We are going to create user-defined tables of quantity/amount pairs, or quantity/percent pairs, that describe our discount structure.

  SetAmt (q1, a1, q2, a2, ...);  // amount based
  SetPer (q1, p1, q2, p2, ...);  // percent based

  where
    q1 = quantity 1 breakpoint
    a1 = amount charged above that breakpoint
    p1 = percent discount above breakpoint
    q2 = quantity 2 breakpoing
    a2 = amount charged above that breakpoint
    p2 = percent discount above breakpoint
    ...

Notice in the JS we run this table backwards to find the first quantity that is less than what the customer ordered. This is how to navigate such tables.

We start with the output of the PayPal button factory and make a few changes. Then the JS processes the FORM and adjusts the fields. Right-click on this page (and <view source>) to see what was done.


[picture] Blah, blah. $10.00 each.

Pricing discounts...

  1 - 4  $10 each
  5 - 9  $9  each
  10 up  $8  each

Input Quantity >      


[picture] Blah, blah. $10.00 each.

Pricing discounts...

  1 - 4  $10 each
  5 - 9  9% off
  10 up  13% off

Input Quantity >      


Image: XHTML 1.1 certified! Image: CSS2 certified! Image: Multi-user accessibility!

Contact me concerning this article at paypalhelper@aol.com. Mention "discounts" in your note.

Individual help starting at $25.00 for simple JS solutions.