Hazel discounts range from "10% off everything on Fridays" store-wide discounts via her discount rules to "Buy 1 Get 1 Free!" volume discounts. Neither is particularly difficult once you get the hang of them, so let's hang ourselves!
If you haven't read the rules files, absorb them now, as we'll first discuss the peculiarities of discount rules, then get into per-item exemptions and volume discounts.
The total calculated discount can be accessed in your templates via the HZML token %HZT_DISCOUNT.
Discount rules are defined in the discount.rules file under the rules directory in your catalog root.
The discount rules file included with the Hazel distribution is named discount.sample, because some folks were going live with KRAZY DISCOUNTS. If you plan to use discounts, be sure to rename the file to discount.rules.
| [Header] | Type | Description | number below is the numeric part of the rule's action | |
|---|---|---|---|---|
| + | x (default) | |||
| PRICE WEIGHT QUANTITY ITEMS | NUM | The price, weight, total quantity, or total unique SKUID of items without a custom DISCOUNT field in the products file. | add number to total | replace total if number is greater |
| STATE COUNTRY | STR | The state or country of the billing address. | add number to total | replace total if number is greater |
| POSTAL_CODE | ZIP | The postal code of the billing address. | add number to total | replace total if number is greater |
| WEEKDAY | WDAY | The day of the week. SUN, MON, TUE, WED, THU, FRI, SAT.
| add number to total | replace total if number is greater |
| DATE | DATE | The date. Eg. 19971010 is "October 10, 1997."
| add number to total | replace total if number is greater |
| TIME | TIME | The time of day. Eg. 175543 is "5:55 pm, 43 seconds."
| add number to total | replace total if number is greater |
| ||||
You can exempt a product from rules file discounts by adding a DISCOUNT field to its entry in the products file with a value of "0" or "none". Here's an example products file entry, featuring the ubiquitous "FOO".
# Foo SKUID: FOO # The product code. PRICE: 1.00 # The base price. (unused because of our discounts) NAME: Foo # The product name. DISCOUNT: 0.00 # No discount for Foo! |
You can also define a discount such as "0.50" to offer 50% off a particular product.
Furthermore, that discount field can define volume discounts based on the quantity ordered. There are three basic types of volume discounts. The first two operate on specific quantities. The last operates on either a specifiy quantity or a range of quantities, and for that gets its very own table.
| Format | Description | Example | Explanation |
|---|---|---|---|
| bxgzf | Buy x items, get z free. | b2g1f | Buy two items, get one free! |
| bxfz | Buy x items for $z. | b3f10.00 | Buy three item for ten dollars! |
| Format | Description | Example | Explanation |
|---|---|---|---|
| bxfze | Buy x items for $z each. | b4f1.00e | Buy four items for a dollar each! |
| bx-yfze | Buy x-y items for $z each. | b4-10f1.00e | Buy four to ten items for a dollar each! |
| b-yfze | Buy y or fewer items for $z each. | b-10f1.00e | Buy 10 or fewer items for a dollar each! |
| bx+fze | Buy x or more items for $z each. | b11+f0.50e | Buy 11 or more items for 50 cents each! |
Some things to know about volume discounts...
%HZT_DISCOUNT "total discount".
Here's an example of a product file entry for the product "FOO", with several tiers of volume discounts. The comments (everything after the octothorpe, hash mark, number sign, pound sign, the "#") are solely for the benefit of the lowly human readers. The first few describe to us what the DISCOUNT field describes to Hazel -- how discounts are to be applied.
# Foo # Buy 5 or less for $1.00 each. # Buy 6-10 for 75 cents each. # Buy 11 or more for 50 cents each. SKUID: FOO # The product code. PRICE: 1.00 # The base price. (unused because of our discounts) NAME: Foo # The product name. DISCOUNT: b-5f1.00e;b6-10f0.75e;b11+f0.50e # The discount! |
To add your own volume discounts, just add a DISCOUNT line to the product you wish to be discounted. It really isn't very difficult. Trust me.
Because of the flexibility of volume discounts, their display on the checkout templates can be somewhat troublesome. As of the current 3.0 version of Hazel, the per-item price (the HZML token %HZI_PRICE) is the same, but the line item total (%HZI_TOTAL_PRICE) reflects the discounts. The volume discount is explained in an order note, which is currently not customizable by the merchant. If you wish the individual item price to reflect the total price divided by quantity, add ADJUST_DISCOUNTED_ITEM_PRICE:1 to your hazel.config file. We welcome any suggestions for improving the volume discount mechanism. Send them to hazel@netsville.com.