setShippingChoice (JS API v2)

Version 2 API only.

setShippingChoice

Method Signature

void ultraCart.setShippingChoice(String selectedShippingMethod);

Description

This is a convenience method for setting the shipping choice on the cart. It does the following:

  • updates the cart.shippingMethod property
  • fires shippingchange event
  • updates the cart asynchronously (but does not fire the usual cartchange event here!)

Parameter

String selectedShippingMethod - the name of the shipping method chosen by the customer

Result

no return value

// imagine the shipping methods listed out as radio buttons ...
jQuery('[name=shippingMethod]').bind('click.ultraCart', chooseShipping);
function chooseShipping() {
  ultraCart.setShippingChoice(jQuery('[name=shippingMethod]:checked').val());
}