There are seven basic methods for calculating shipping. The first three are relatively easy to understand but the final four, which involve setting up an array of prices, are quite complex but powerful. Of course you don't have to use shipping at all and you can have the entire shipping line removed from the cart.

 

Option 1 : a fixed value

This is simply a fixed value that is added to each order to cover for shipping.

 

Option 2 : based on quantity of items purchased

In this case shipping is calculated by multiplying the total number of items in the cart by a fixed amount. This is fine if all your items are around the same size and weight; for example, like CD's.

 

Option 3 : based on a total of weight or some other value

To use this option you will need to include the extra field "units" to all your links or forms that add items to the cart. The value of "units" would be the weight, or whatever unit you choose, for one item of that product. Shipping is then calculated by multiplying the total number of units by a fixed amount per unit.

Another typical use is to set "units" equal to the value of the item. For example; if the price=9.99 then units=9.99. It is then possible to do a calculation of shipping based on the total value of the order; 10% would equal a rate of 0.1 per units. You can have the cart do this automatically for you by checking the special shipping by value checkbox. You then don't need to include a units field at all..

 

Option 4 : shipping array by quantity

This is the first of the two mechanisms that use an array or table of values to calculate shipping. In this case, as in Option 2, the calculation is based on the total quantity of items in the cart. However the value of the shipping applied to each product depends on the number of products purchased.

As an example; your customer chooses to purchase 6 items from your store. You charge the customer $10 for the first item and $5 for the next 3 items and nothing for the last 2 items making a total of 1 * $10 + 3 * $5 + 2 * 0 = $25 for shipping. You can use up to five bands in this way creating a scale of shipping charges.

Finally you can choose to setup an array for up to five different geographical areas, such as, Local, National, International, etc. The customer is prompted to select which of these is relevant to them from a drop down list. You choose the description for the areas that go in this list. Alternatively you might want to offer different shipping rates; Standard, Next day and three day instead.

 

Option 5 : shipping array by alternative unit

This is a hybrid of Option 3 and 4. In this case you will need to post the field "units" along with each product as it is added to the cart. Shipping is then calculated using the array but using the sum of the "units".

As in the case of option three, whilst the unit is often weight, you could use something else, for example, the value or the volume of the order.

You can have units set automatically to the same as the price; shipping by value.

 

Option 6 & 7 : shipping array by bands

These are very similar to options 4 and 5 except in this case shipping is charged in bands.

For example, you might charge the first item $10 as before but any quantity between two and eight items an extra $5. And so on for up to five bands. So in this case someone buying two items pays the same as someone buying 8 items, $15.

 

With options 6 the calculation is based on the total quantity of items in the cart, with option 7 it is based on the sum of the "units" field (as in options 4 and 5).

 

Option 8 : Posting in your own shipping cost

You can post in your own total shipping cost for an order in a field named shipping. You can include it when you are adding a product to the cart but in practice it's probably most useful with a Review Cart link:


<A HREF="http://ww#.aitsafe.com/cf/review.cfm?userid=0123456&shipping=9.99"> Add shipping </A>


Where the value 0123456 needs to be replaced with your username and # needs to be replaced with the number of server your account is setup on.


You can also post in any data you like, for example if you want to record what options the customer choose when they used your shipping calculator. Use a field named shipopts. The data is not displayed to the customer but it is stored along with the rest of the details about the order.

 

SHIPPING API

There is a simple shipping API (Application Programming Interface) if you are using your own external shipping calculator. Provided that the total units in the cart are more than zero the customer will be forced to add shipping from your calculator before they can move on and pay for the goods.


Enter an HTML link to your calculation script in the message box. The special string {x} will be replaced with a query string containing the total units currently in the cart, the value of the products plus the language and currency variables: For example you might enter in the setup


To calculate shipping for this order
<a href="http://www.yoursite.com/cgi-bin/ship.cgi?{x}"> click here </a>


The fields included in {x} are:

units - the total units in the cart
value - the value of the cart contents before tax, discounts and shipping
return - the current URL for the Continue shopping button
lg - the current language
sd - your session data

You may not be using some of these fields, they are optional, but they are there so that you can maintain continuity if you need to.