Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejavascript
themeDJango
linenumberstrue
// Define a callback function 
function myCallbackFunction(shippingEstimates){
    for (var = i; i < shippingEstimates.length; i++) {
        // Do something with the estimate
    }
}

// Make the asynchronous call 
estimateShipping({'async': true, 'onComplete': myCallbackFunction});
Tip

Our recommendation is to make the the shipping estimate call asynchronous due to the time it can take calculate estimates. Make sure that you give the customer a visual indication that shipping estimates are being calculated. We do not recommend making calls that manipulate the cart asynchronous as it could cause inconsistancies in the global cart variables contents.