Individual Shipping Per Product Per Zone

By | October 25, 2012

Approached recently by a potential customer who needs to set up a system for charging postage on a per product basis, per geographic zone. This needs to work as a “extra cost” on top of the usual shipping cost. Think in terms of an awkward to send product where you might want to charge $10 extra on top of the usual shipping fee. I’ll illustrate this with an example…

Step 1: Set up a couple of zones (for shipping purposes)
Although this says “tax zones” they can be used for shipping geographically.

Step 2: Edit (or create) a product
On this page we have extra input box asking for the shipping price per zone.

This defaults to zero, in here you can insert different price per zone. In the example, I’ll make the fee 5 for UK and 10 for Europe. I press “Save” to update the details of the product.

Step 3: Set up your Shipping Method(s)

For this example I’ll use the easiest (to look at) shipping module which is “flat rate”. I’ve set the fee to 2.50 flat fee for all orders.

Making an Order

If I now place into my cart a product that has NO extra cost set up, the shipping module will return 2.50 as the shipping cost.

Now if I also add a product that I have placed an extra cost (Unreal Tournament in this example), the shipping should show a total of 7.50 (which is 2.50 flat fee + UK extra cost of 5).

Hopefully, you’ll have read between the lines and understand that I could just as easily have created a new shipping module to only read the value of the extra cost parameter (per zone). In this way, I can set shipping prices per product and not have to have it react as a “surcharge” on top of an existing shipping module (as shown in this example).


Hopefully you can see that osCommerce is fairly easy to modify if you work out what you need to do in advance, understand how osCommerce hangs together and then stick to the project at hand.

For this example, the main files modified are admin/categories.php and the order_class file. The rest is simple arithmetic.

4 thoughts on “Individual Shipping Per Product Per Zone

  1. Gary Post author

    This has now evolved! The extra surcharge per product needs to be on two levels. Example: buy 1 sucharge is £5. Buy 3 surcharge is 1 x £5 + 2 x £3 = £11.

    I try to write code in a modular way, so updating the base code to allow this was not a big job. I had to add in an extra box in categories.php (and some “add to database” logic);

    Now, if 1 product is in the cart, remembering the base shipping of £2.50, the shipping cost is an extra £5 making it £7.50 (as it was previously);

    And if I add a second of the same product, the shipping is now £10.50, that is £2.50 + £5.00 + £3.00


  2. John

    What I would like to see.

    A product with a set weight.

    You can choose to set products from that manufacturer to ship free to any zone you want.

    And for zones where free shipping is not selected it charges the table weight.

    I think this is essential for people who have cheap national shipping so do it for free but still want to charge the real amount to international customers.

  3. Gary

    John – this can be made if you want it. Email me with full specifications and I’ll be happy to quote you.

Leave a Reply

Your email address will not be published.