Configurator object with its state for any additional data
Items being requested with default amounts in one set
Configuration options selected by the user
Total amount of sets requested by the user
function handleCheckoutInit(context) {
for (const item of context.demandItems) {
for (const product of item.definition.product_variants) {
Shop.addToCart({
id: product.identifier,
count: context.totalAmount * item.amount * product.amount,
});
}
}
Shop.showToast("Products from the configuration added to your cart.");
return false;
}
Function that is called when the user initializes the checkout process, before even displaying the checkout form.
Return
falseto prevent displaying the default checkout form.This function can be asynchronous (it will be awaited), but does not have to be.