Drupal Answers is a question and answer site for Drupal developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am building an e-commerce site. When a shippable item is added to the cart I have to add some fixed shipping cost to the order which I am able to do with flat rate. But I have to add an option "Residential Delivery Fee" while showing shipping cost on checkout page. If user select this option during checkout then I have to add another shipping cost to the order.

I am unable to figure out that how to add this conditional shipping cost.

share|improve this question
If possible shift to Drupal Commerce and use the Rules magic sauce :P – Gokul N K Sep 2 '13 at 7:22

Here the idea,

  1. Using hook_checkout_pane() include your option "Residential Delivery Fee" as checkbox
  2. Then while saving order check if user selected this option. Use hook_order
  3. If user chose this option, you can add your shipping charge as line item with the function uc_order_line_item_add().


function hook_order(){
switch ($op) {
case 'save':
//if the checkbox was selected, we add the line item to the order. the following function  will add 100 to order total as shipping charge
      t('Residential Delivery Fee'), 
      array () 


I successfully implemented this idea for one of my client site

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.