Surcharges are the converse of discounts. They're used to add miscellaneous charges to an order. This document discusses how to apply your own custom surcharges. Be sure you've read the rules documentation before proceeding.
If documentation bores you, just take a look at the sample surcharge.rules file. It assigns a COD charge to orders whose payment method is "COD".
The total calculated surcharge can be accessed in your templates via the HZML token
%HZT_SURCHARGE.
Surcharge rules are defined in the surcharge.rules file under the rules directory in your catalog root.
It's worthy of noting that surcharge rules have no unique headers. Those listed below are available in all rules files.
| [Header] | Type | Description | number below is the numeric part of the rule's action. | |
|---|---|---|---|---|
| + (default) | x | |||
%HZE_ANYTHING;TYPE
| STR ZIP WDAY DATE TIME | Any HZML token and its evaluation type, separated by a semi-colon. | add number to total | multiple total by number |
%HZE_ANYTHING;NUM
| NUM | Any numeric HZML token. Same syntax as above, but numeric types have different actions. | add number to total | add header value multiplied by number to total |
| WEEKDAY | WDAY | The day of the week. SUN, MON, TUE, WED, THU, FRI, SAT.
| add number to total | multiple total by number |
| DATE | DATE | The date. Eg. 19971010 is "October 10, 1997."
| add number to total | multiple total by number |
| TIME | TIME | The time of day. Eg. 175543 is "5:55 pm, 43 seconds."
| add number to total | multiple total by number |
| ||||