I have complex requirement on calculating shipping charges based on the destination country and total amount.

For ex:

0-20 US $5
21-40 US $10
41-60 US $15
60-80 US $17
80-100 US $19
---
----

Similar to this, we have charges for Canada and Mexico.
Is there any way that I can call a PHP function(which will retrieve shipping charge from cck or a custom table) by providing two parameters (Country and total amount)?

I tried with conditional actions, but because i have too many rules it gets bigger and bigger and cumbersome.

Thanks,

Comments

tr’s picture

Status: Active » Fixed

There are three ways to do this in Ubercart:

1) Use the built-in Conditional Actions to check both the order total and destination country, selecting an appropriate rate for each combination.

2) Write a custom Conditional Action with PHP to do this. Useful for more complex conditions.

3) Write a custom shipping module. It is very easy to take uc_flatrate as a template for your own shipping module, then modify it to perform whatever calculations you desire.

getstarted’s picture

Thanks, I went with option 3 and worked like charm. Thanks,

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

philpro’s picture

getstarted, care to share your source code for this? I'm looking for the same solution.

summit’s picture

Subscribing, interested in code also!
greetings, Martijn

cybershan’s picture

Subscribing...

cybershan’s picture

when user select the country option on Checkou page, the value only be known on Client side, not posted to server side, How to let shipping module know what country user selected ?

madhattertech’s picture

I also needed to create a custom shipping module. This site helped me so I thought I would pass it on.

http://tiger-fish.com/blog/tutorial-writing-drupal-6-ubercart-shipping-m...

Mike