Utility to calculate insurance and determine the correct Onward variant to add to cart. Exposed on window as OnwardInsuranceCalculator.
In order to use this directly you will need to implement your own loading of the Onward product and its variants from Shopify.
const insuranceVariants = myLoadInsuranceProductVariants();
const insuranceCalculator = new OnwardInsuranceCalculator(insuranceVariants, OnwardSettings.load());new InsuranceCalculator(
insuranceVariants,settings,locale):InsuranceCalculator
ILocale = null
InsuranceCalculator
insuranceVariants:
ProductVariant[]
locale:
ILocale=null
settings:
OnwardSettings
insurancePrice(
lines):number
Calculate the price of insurance for the cart.
CartLine[]
Current cart line items
number
insuranceVariant(
lines):ProductVariant
Determine the Onward insurance variant to add to cart in order to insure the order.
CartLine[]
Current cart line items