I made this for a business in Singapore that sells family sized pies (yummy).
There were several demands on the form. The first was free delivery if the buyer orders more than $100 worth, as the products are different prices, we cannot use discountpr. Next, we had a delivery charge, this was a varied charge based on the first two numbers of the buyers postal area/zip code. We also had to pick a date and time for the delivery. Another demand was that all except one of the date/time/name/address/postal area etc fields was mandatory.
How I did it!
The running total was easy, I used my running total script, then to check if the order is over $100 and then waive the delivery charge, I used one of the mandatory fields (name) to check the total value of the order and to write the 'price1' value (delivery) to a zero.
But first we need to calculate the delivery charge, for this I built an external script holding the first two numbers of the postal area and the cost of delivery for those numbers. The area codes are 10 to 83, if you enter a number beginning with 10, you'll see the delivery charge is $5, enter 83 and the delivery charge is $6, the delivery charges range between $3 to $7.
You'll need to download and link to the external scripts where I've marked in the head of this page.