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:
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 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>