Skip to content

Commit def4c79

Browse files
committed
return empty op instead of throw
1 parent 94df3ff commit def4c79

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

functions-discount-js/src/cart_delivery_options_discounts_generate_run.liquid

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
export function cartDeliveryOptionsDiscountsGenerateRun(input) {
1818
const firstDeliveryGroup = input.cart.deliveryGroups[0];
1919
if (!firstDeliveryGroup) {
20-
throw new Error("No delivery groups found");
20+
return {operations: []};
2121
}
2222

2323
const hasShippingDiscountClass = input.discount.discountClasses.includes(
@@ -68,7 +68,7 @@ export function cartDeliveryOptionsDiscountsGenerateRun(
6868
): CartDeliveryOptionsDiscountsGenerateRunResult {
6969
const firstDeliveryGroup = input.cart.deliveryGroups[0];
7070
if (!firstDeliveryGroup) {
71-
throw new Error("No delivery groups found");
71+
return {operations: []};
7272
}
7373

7474
const hasShippingDiscountClass = input.discount.discountClasses.includes(

0 commit comments

Comments
 (0)