Utility to calculate protection and determine the correct Onward variant to add to cart. Exposed on window as OnwardProtectionCalculator.
In order to use this directly you will need to implement your own loading of the Onward product and its variants from Shopify.
const protectionVariants = myLoadProtectionProductVariants();
const protectionCalculator = new OnwardProtectionCalculator(protectionVariants, OnwardSettings.load());new ProtectionCalculator(
protectionVariants,settings):ProtectionCalculator
ProtectionCalculator
protectionVariants:
ProductVariant[]
settings:
OnwardSettings
protectionPrice(
lines):number
Calculate the price of protection for the cart.
CartLine[]
Current cart line items
number
protectionVariant(
lines):ProductVariant
Determine the Onward protection variant to add to cart in order to protect the order.
CartLine[]
Current cart line items