Checkout 3.0
Shipping option changed callback

Shipping option changed callback

Optional callback that allows partner to get shipping option price and currency for currently selected shipping option in Ingrid form inside Checkout3.

Callback is triggered in multiple cases:

  1. Ingrid form is loaded inside Checkout3 form
  2. New shipping option is selected in Ingrid form by the user

Registering callback

To use this optional callback, partner has to pass an additional flag shippingOptionChangedCallback to avardaCheckoutInit. Please refer to Showing the checkout form for additional info about Checkout 3 Form initialisation.

Callback payload

Callback payload is an object with price and currency properties as the first parameter and checkoutInstance as the second parameter (not neccesary to use it). Below you can see a code example.

<script>
  var shippingOptionChangedCallback = function (
    { price, currency },
    checkoutInstance,
  ) {
    console.log('Price: ', price);
    console.log('Currency: ', currency);
 
    // Use data for your business logic
  };
</script>