widgeta~3=P.95If a shopper adds 3 or more of an item with the part number widgeta to the cart, they pay 95% of the programmed cost (5% discount).
The cart displays the single "unit" price as usual, but the "cost" for the three would look like this:
We use separator characters to make the discount code lines easy to parse and understand.$29.97
$28.47
The ~ (tilde) separates the part number matched, or Match Code, from the Quantity Breakpoint and Discount Action.
The = (equal) separates the Quantity Breakpoint from the Discount Action.
widgeta~3=P.95^5=P.8^10=P.7As you may have surmised, repeatedly using the caret separator allows concatenation of as many Breakpoint=Action combinations as you wish.
widgeta~3=F1.25Can you guess what the discount action F1.25 did? You are correct if you said it subtracts a Fixed $1.25 from the regular price of the item.
widgeta~3=C1.25Three or more widgeta's are going to Cost the shopper $1.25 each. Less than three would of course be charged at the regular price, since the first quantity breakpoint has not been reached. (Regular price is what is coded into the "item" variable on your product html pages.)
widget.*~3=P.95The above code would counts any part number starting with "widget" towards the breakpoint of three. Two widgeta's and one widgetb would cross the threshold and give the shopper a 5% discount on each widget. The key is the .* code, which matches . (dot - any single character) followed by * (asterisk - zero or more occurances of preceding character).
What are we talking about? The discount system uses a very powerful matching routine called "regular expressions". Regular expressions can get incredibly complex if you let them. If you don't understand them, keep it simple and you'll be ok. We'll provide some example match codes here that should cover most situations.
| widgeta | matches just "widgeta" |
| widgetb | matches just "widgetb" |
| widget. | matches "widgeta" or "widgetb", but NOT "widgetax" or "widget" |
| w.dget | matches "widget" or "wadget"...any single char where the dot is |
| .*widget | matches any partnumber ENDING with widget, but NOT "widget" by itself |
| .*widget.* | matches any partnumber with widget in the middle but NOT "widget" by itself |
| *widget* | matches any partnumber with widget anywhere inside, INCLUDING "widget" by itself |
| widget[0-9] | matches "widget0", "widget1"... "widget9", but NOT "widgeta" |
| * | matches EVERYTHING. What an easy way to have a sale! |
!widgeta~3=P.95Commenting makes it easy to turn discounts off and on without having to type (paste) them into the form again.