How do I automate shipping calculation?
I'm still using D6 but I did something similar with jQuery:

Make a mymodule.module file that goes like this:

&lt;?php

function mymodule_form_alter(&amp;$form, &amp;$form_state, $form_id){
  if ($form_id == 'uc_cart_checkout_form'){

    drupal_add_js(drupal_get_path('module', 'mymodule') . '/mymodule.js');

  }
}


The format of your hook_form_alter may be different in 7, but there are tutorials all over the place for this. The point is that you use drupal_add_js (again, format may differ) to cram some javascript onto only the form with the ID you want - your checkout form.

Make a mymodule.info that goes like this:


name = Re-calculate Shipping
description = Use JavaScript to automatically click the Calculate Shipping button at checkout.
core = 6.x
dependencies[] = uc_quote
package = "Example.com custom modules"


(But you're core is 7.x - copy another module's info file.)
And make a mymodule.js file that goes something like this:

$(document).ready(function(){
      $("#edit-panes-quotes-quote-button").click();
      $("#edit-panes-delivery-copy-address").click();
});

$(document).ready(function(){
   $("#edit-panes-billing-billing-zone").change(function() {
      $("#edit-panes-quotes-quote-button").click();
   });
});

$(document).ready(function(){
   $("#edit-panes-delivery-delivery-zone").change(function() {
      $("#edit-panes-quotes-quote-button").click();
   });
});


Note that this just clicks the "calculate" button for the user, but I'm sure that you can work out how to use jQuery to click more things.

Imagine you have a drop-down select with the attribute id="cram".
In your js file you would use $("#cram") to select anything with the ID "cram":

$("#cram").change(function() {


Sticking .change() on the end triggers anything between the brackets after .change when the #cram element changes, such as when a different fruit / rodent is selected. we're triggering a function here, and it is defined in-situ.

Sticking .click() on the end of a selector clicks the selected element.

Enjoy :)