# Algorithm Based Examples

## Alternative Delivery Method Algorithm

This algorithm allows you to define an alternative delivery type when the delivery type differs between two or more shipping groups.

The rate displayed will depend on the totalling algorithm used.

In this example the “Apply Shipping Group * to all Items” option is set to “No”.

• When * and “Alpha” are in the cart together show “Two Day”
• When * and “Beta” are in the cart together show “Next Day”
• When all three groups are in the cart together or “Alpha” and “Beta” are in the cart together show “Two Day”

Alternative Shipping Method Example CSV:

ALT= will take effect if the Delivery Type cannot be matched across Shipping Groups. It will look at the alternate delivery type (in order of sequence of entry) and determine if it can match on each of them.
For more examples of the alt= algorithm and caveats to look out for, see the Working with Multiple Shipping Groups guide.

## Override All Other Rates Algorithm

This algorithm will override all other rates for a shipping method if the row in the CSV file its defined on is applicable.

In this example, we’re  going to offer Ground shipping and Express shipping.

If a product with the shipping group “OVERRIDE_FREE” is added to the cart, Ground shipping should be free for the entire order. Express should be unaffected.

Override Algorithm Example

## Weight Surcharge Algorithms (WC & W)

This example shows you how to add an extra \$1.50 for every pound in weight which added to the cart after the initial 1 pound.The initial pound is not included in the calculation.

We’re going to say the base shipping price is \$5.00

We’re going to say the product is a pair of headphones and weights 0.3Lbs. This is how the shipping should work out:

1 to 3 pairs of headphones = \$5

4 to 6 pairs of headphones = \$6.50

7 to 11 pairs of headphones = \$8.00

and so on…

In this example, we’re going to round the weight up to the next whole number. This means we will need to use the “WC=” algorithm. So for example when we have 7 pairs of headphones in the cart the weight (excluding the first 1lbs) will be 1.1Lbs; using WC the weight will be rounded up to 2Lbs and so the calculation will be:

2 x \$1.50 + \$5.00 base charge = \$8.00 shipping charge.

If we were to use the “W” algorithm instead, that would mean the weight is not rounded. In the example above the calculation would change to:

1.1 x \$1.50 + \$5.00 base charge = \$6.65 shipping charge.

Weight Based Surcharge Example

## Item Surcharge Algorithms (I & IM)

#### Add a Surcharge per Item

This example shows you how to add an additional \$5 per item to the shipping cost when the cart has at least 10 items in it. The base shipping cost is \$10.

The shipping would work out like this:

0 to 10 items: \$10

11 items: \$15

12 items: \$20

and so on…

Item Based Surcharge Example

#### Add a Surcharge per Every X Items

This example shows you how to add an additional \$10 to the shipping cost for every 5 items added to the cart once the cart has at least 10 items in it. The base shipping cost is \$10.

The shipping would work out like this:

0 to 10 items: \$10

11 to 15 items: \$20

16 – 20 items: \$30

and so on…

Per Item Surcharge Example

#### Add a One Time Surcharge for Specific Items [Highest Price Totalling]

This algorithm is only supported when using Highest Price Totalling. If you use it with any other totalling algorithm, it will behave like “i=”.

This example demonstrates how to add a one time fee of \$10 to the shipping cost if a item is added that is in the shipping group “Flowers”.

One Off Item Surcharge Example

## Percentage Algorithm

#### Shipping Price is a Percentage of Cart \$ Price

This example shows you how you can charge a shipping fee which is a percentage of the overall cart price.

In this example we would like to charge these shipping prices:

USA: 5% of cart price

UK: 15% of cart price + \$10 flat fee

Percentage of Cart Value Example

## Residential / Commercial Algorithm

This algorithm enables you to offer different shipping methods and rates based on the customers address type (Residential/Commercial). This is used in conjunction with WebShopApps Residential Commercial Selector

In this example we would like to offer Commercial customers a \$2 shipping discount over Residential customers.

Commercial shipping will be \$12, Residential shipping will be \$14.

Residential Surcharge Example

## Custom Shipping Code Algorithm

This example shows you how to store a custom shipping code in your database for use with a 3rd party order management system or fulfilment system. This is stored as the “shipping_method” in sales_flat_order. The shipping method name is stored in the same table as “shipping_description”.

In this example we want to store FedEx shipping options with specific codes:

FedEx Ground = FDXGND

FedEx 2Day Air = FDX2DY

FedEx Overnight = FDXOVR

Custom Shipping Codes Example

## Maximum Shipping Cost Algorithm

This algorithm enables you to set a maximum shipping cost for the order if the rule this algorithm is set on is matched.

In this example we’re going to offer a “Standard” shipping method which costs \$10 for orders under \$99 and \$20 for orders over \$99. We also have a special product which costs \$10 to ship, if that item is added to the cart we want to say the maximum cost of shipping is \$10 for the whole order.

Maximum Shipping Cost Example

You can also add a maximum shipping cost to the entire CSV file through the admin interface. Navigate to `System->Configuration->Shipping Methods->WebShopApps ProductMatrix` and find the field called “Maximum Shipping Cost”. This applies to every rule in the CSV file and is on a per order basis.

## Stock Based Algorithm

This algorithm gives you the ability to offer different shipping methods and rates based on the stock status of all items in the order.

In this example we’re going to offer “Express Delivery” if all items are in stock. If there’s any items out of stock, we want to offer “Delayed Delivery (7 – 10 Days).

Stock Based Example

## Show Method for All Items Algorithm

This algorithm enables you to show a shipping method for all items in the cart, even if it’s not defined as available for some products (Unless you explicitly define it as unavailable by using -1 as the shipping price).

In this example we’re going to offer Standard shipping for all items in the cart. If a product with the shipping group “Collection” is added to the cart, we want to offer “Store Pickup” as a shipping option for all items in the order.

Show Method for All Example

This algorithm allows you to ignore additional items being added to the cart when using any of the “Per Item” totalling algorithms therefore making the cart price a set price when this rule is matched.

If there are products in the cart that match the criteria of this rule then the price will set at a fixed rate, this fixed price will not increase or decrease depending on the number of products in the cart. For example if 9 products are in the cart the price will still be set at the fixed rate for the total cart.

In this example we’re going to set the cart shipping price to £5GBP for UK mainland but for Northern Ireland we want to charge £13GBP per item.

## Tracking Algorithm

If you want to add a tracking number for a particular shipping method then this algorithm will link the shipping method with a tracker. Then in `Sales->Orders-><New_Order>->Shipments` you can select the shipping method and add a tracking number.

Tracking Example

## Promotional Code Algorithm

This example shows you how to offer a different shipping method based a promotional code that’s entered. In this example we want to show a new shipping method called “Free Courier Delivery” if the promotional code “Free456″ is used.

The “coupon=” algorithm allows a different delivery type to be shown when a coupon code is entered at the front end of the store. The algorithm can also be used to offer discounted/surcharged rates if a coupon code is entered.

##### Result when the promotional code is entered

Promotional Shipping Example

## Error Message Algorithm

This example shows how to display a custom error message when no rates are available at the frontend of the store to your customers.

The algorithm needed to be used is error=

Below is a screenshot to show how this algorithm will be created:

In this CSV file when shipping to the state of New York (NY) the custom error message of ‘We do NOT ship to this location’ will be displayed at the frontend of the store.

To show this error message you must have the option ‘Show Method if Not Applicable’ set to Yes as shown in the below screenshot.

Below shows the results when shipping to California (CA) which returns rates as expected:

Also when shipping to New York (NY) which displays the custom error message:

## Day Algorithm

The day= algorithm allows for certain shipping methods to only be shown on certain days.

For the example below we have configured the extension so that Standard Delivery will be shown all week round. But the methods of Next Day will only be shown on Monday, Tuesday, Wednesday and Thursday. But Saturday Delivery is only available on a Friday.

The way the days are defined are by using a corresponding number so Monday = 1 and Sunday = 7

As shown in the following screenshot when shipping the item on a Wednesday the method of Next Day delivery is available. But the method of Saturday delivery is not shown as available as we are not shipping the desired items on a Friday.

One vote

Featuring WPMU Bloglist Widget by YD WordPress Developer