Discount\",\"buyXGetYQuantityValidationLabel\":\"Add {{product_quantity}} quantities of the gift product (Get Y)\",\"primaryTextColor\":\"#000000\",\"modalOpenOnAddToCart\":true,\"notApplicableForSubscribeAndSaveNotificationTitle\":\"Not applicable for subscribe & save\",\"customSignInLink\":\"\",\"productDiscountAppliesOnOneTimePurchase\":true,\"loginAlertTextLabel\":\"You need to login to purchase this bundle.\",\"buyXGetYChooseProductLabel\":\"Choose Product\",\"chooseAPlanLabel\":\"Choose Plan\",\"singleParentProductDirectRedirectToChildProducts\":true,\"buyXGetYFixedDiscountText\":\"Enjoy a fixed discount of {{discount_value}} {{currency}}\",\"primaryColor\":\"#000000\",\"buyXGetYGiftProductPriceVisibilityType\":\"UNIT_PRICE\",\"shippingDiscountRecurringCycleLimit\":0,\"volumeDiscountVariantSelectLabel\":\"Denominations\",\"chooseSourceProductValidationLabel\":\"Please choose source product!\",\"shippingDiscountAppliesOnSubscription\":true,\"volumeDiscountSpentAmountRewardsLabel\":\"Spend {{currency}}{{spent_amount}} and get {{discount}}{{discount_type}} discount!\",\"volumeDiscountRecurringCycleLimit\":0,\"getYNoProductSelectedLabel\":\"No gift product selected (Get Y)\",\"hideVariantSelectLabel\":false,\"availableOnlySubscriptionLabel\":\"Available Only On Subscription\",\"enableParentProductDetailButton\":false,\"chooseAssociatedProductsValidationLabel\":\"Please choose associated products!\",\"selectedSourceProductLabel\":\"Selected\",\"enableBuyXGetYWidgetMergeAsOptions\":false,\"volumeDiscountNextApplicableSpentAmountRewardsLabel\":\"Spend {{spent_amount}}{{currency}} get {{discount}}{{discount_type}}\",\"sectionNoProductSelectedValidationLabel\":\"No product selected for: {{section_name}}!\",\"buyXQuantityValidationLabel\":\"Add {{product_quantity}} quantities of the product (Bux X)\",\"sectionMaximumQuantityValidationLabel\":\"Maximum quantity not selected for: {{section_name}}!\",\"volumeAmountDiscountSaveRewardsLabel\":\"Save {{currency}}{{discount}}!\",\"sectionLabel\":\"Section\",\"disabledTextColor\":\"#6B7280\",\"primaryHoverColor\":\"#000000\",\"shippingDiscountCombinedWithOrderDiscount\":true,\"defaultDiscountBarMessage\":\"Welcome to our store\",\"buyXGetYDiscountCombinedWithOrderDiscount\":true,\"bundleSubtotalLabel\":\"Subtotal\",\"reviewOrderDescription\":\"Check your items and select your required frequency plan\",\"dynamicBundleDiscountCombinedWithOrderDiscount\":true,\"volumeDiscountSaveRewardsLabel\":\"Save {{discount}}{{discount_type}}!\",\"addingProductsToBundle\":\"Adding products to bundle\",\"buyXGetYMergedWidgetTitle\":\"Select Buy X Get Y Discount\",\"bundleModalHeaderLabel\":\"Your Bundle({{total_quantity}})\",\"productAddedToBundleNotificationDescription\":\"{{product_title}} added to bundle.\",\"dynamicBundleDiscountAppliesOnSubscription\":true,\"bundleTopHtml\":\"\",\"proceedToCheckoutButtonText\":\"\",\"showDraftProduct\":false,\"switchSubscriptionLabel\":\"Subscribe & Save\",\"percentDiscountText\":\"Get {{discount_value}}% off on your purchase!\",\"discountUsageLimitExceedLabel\":\"You have exceeded the bundle usage limit\",\"reviewOrderLabel\":\"Review Bundle\",\"chooseSectionProductsLabel\":\"Choose Section Products\",\"primaryDisabledColor\":\"#333333\",\"bundleMinimumOrderAmountLabel\":\"Add minimum {{minimum_amount}} order amount\",\"dynamicBundleDiscountRecurringCycleLimit\":0,\"breadCrumbSelectSectionLabel\":\"Select Section\",\"loadMoreButtonLabel\":\"Load More\",\"bundleQuantityRewardsLabel\":\"Add {{quantity}} item, get {{discount}}{{discount_type}} discount\",\"shippingDiscountCombinedWithProductDiscount\":true,\"sellingPlanNameSortOrder\":\"ASC\",\"switchOnTimeLabel\":\"One Time\",\"volumeDiscountCombinedWithProductDiscount\":true,\"chooseProductsText\":\"Products\",\"productDetailsViewType\":\"SHOW_PRODUCT_POPUP\",\"enableManualBundleBlockIntegration\":false,\"volumeDiscountNextApplicableQuantityRewardsLabel\":\"Buy {{quantity}} get {{discount}}{{discount_type}}\",\"bundleCheckoutLabel\":\"Checkout\",\"productDiscountCombinedWithShippingDiscount\":true,\"skipSelectSectionPage\":false,\"buyXGetYFreeLabel\":\"Free\",\"dockbarHeadingLabel\":\"Bundle\",\"discountMessageInterval\":3000,\"buyXGetYAddToCartLabel\":\"Add to cart\",\"buyXGetYDiscountCombinedWithShippingDiscount\":true,\"dynamicBundleDiscountCodeText\":\"BUNDLE_DISCOUNT_{{bundle_id}}\",\"productDiscountAppliesOnSubscription\":true,\"selectedProgressLabelText\":\"{{total_bundle_items}} item added with a minimum quantity of {{minimum_quantity}}\",\"requiredBundleProductLabel\":\"Your bundle needs {{min_product_count}} more item(s).\",\"sellingPlanSelectionDropDownLabel\":\"Purchase Options\",\"buyXGetYPercentDiscountText\":\"Enjoy a percentage discount of {{discount_value}}%\",\"dockbarDescriptionLabel\":\"You're getting the most rewards!\",\"productDiscountRecurringCycleLimit\":0,\"preventClickableProductsOnCart\":false,\"enableProductDetailButton\":false,\"discountTargetType\":\"VARIANT\",\"customOfferLink\":\"collections/all\",\"noItemsInBundle\":\"No items added to the bundle\",\"variantSelectionDropDownLabel\":\"Variants\",\"chooseSectionLabel\":\"Choose Section\",\"breadCrumbPlanLabel\":\"Select Plan\",\"showDynamicBundleOrderNote\":false,\"showOutOfStockProduct\":true,\"disabledSellingPlanSelectionValidation\":false,\"bundleDiscountLabel\":\"Discount\",\"volumeDiscountAppliedQuantityRewardsLabel\":\"Applied: buy {{quantity}} get {{discount}}{{discount_type}}\",\"bundleNotEligibleLabel\":\"You're not eligible to purchase this bundle!\",\"reviewOrderProductsLabel\":\"Bundle Products\",\"outOfStockLabel\":\"Out Of Stock\",\"showUnitPrice\":false,\"buyXGetYFreeGiftDiscountText\":\"Enjoy the free product\",\"showDescriptionPopup\":true,\"readMoreText\":\"Read More\",\"totalBundleProductsAddedLabel\":\"{{total_bundle_items}} Products Added\",\"bundleMinimumQuantityLabel\":\"Add minimum {{minimum_quantity}} product\",\"noSourceProductSelectedLabel\":\"No source product selected.\",\"nonListedProductText\":\"Non-Listed\",\"buyXNoProductSelectedLabel\":\"No product selected (Buy X)\",\"volumeDiscountQuantityRewardsLabel\":\"Buy {{quantity}} quantity and get {{discount}}{{discount_type}} discount!\",\"freeShippingLabel\":\"Free Shipping\",\"previousButtonLabel\":\"Previous Step\",\"draftBundlePageTitle\":\"Oops! This bundle is temporarily unavailable.\",\"productDetailsMaximumDescriptionCount\":300,\"oneTimeOnlyLabel\":\"One time only\",\"buyXAnyNumberOfProductChooseLabel\":\"Choose any number of products\",\"productFilterConfig\":\"{\\\"enabled\\\":false,\\\"filters\\\":[]}\",\"volumeAmountDiscountQuantityRewardsLabel\":\"Buy {{quantity}} quantity and get {{currency}}{{discount}} discount!\",\"disableDiscountedPricingRedirectToCart\":false,\"volumeDiscountCombinedWithOrderDiscount\":true,\"dynamicBundleDiscountAppliesOnOneTimePurchase\":true,\"choosePlanButtonLabel\":\"Choose Plan\",\"bundleQuantityLabel\":\"{{quantity}}x\",\"showClassicBundleWidgetInChildProduct\":false,\"shippingDiscountAppliesOnOneTimePurchase\":true,\"classicBundleLinkLabel\":\"Go to the Classic Bundle\",\"bundleDetailsLabel\":\"Your bundle:\",\"buyXGetYDiscountAppliesOnOneTimePurchase\":true,\"volumeDiscountAppliedSpentAmountRewardsLabel\":\"Applied: spend {{spent_amount}}{{currency}} get {{discount}}{{discount_type}}\",\"enableAutoRemoveRelevantBundleItemInCart\":false,\"bundleModalShowRewardsLabel\":\"Show all rewards\",\"buyXGetYDiscountRecurringCycleLimit\":0,\"cartAndCheckoutMandatoryProductValidationMessage\":\"This bundle or discount must include all required products and they cannot be removed.\",\"volumeAmountDiscountSpentAmountRewardsLabel\":\"Spend {{currency}}{{spent_amount}} and get {{currency}}{{discount}} discount!\",\"notApplicableForOneTimeNotificationTitle\":\"Not applicable for one time\",\"showDiscountToNonEligibleCustomers\":false,\"primaryDisabledTextColor\":\"#ffffff\",\"draftBundlePageSubTitle\":\"In the meantime, check out our latest offers and discounts!\",\"volumeDiscountCombinedWithShippingDiscount\":true,\"bundleSpentAmountRewardsLabel\":\"Spent {{spent_amount}} worth of items, get {{discount}}{{discount_type}} discount\",\"nextButtonLabel\":\"Next Step\",\"classicBundleDescriptionLabel\":\"Your bundle contains the following products.\",\"bundleBottomHtml\":\"\",\"sectionMinimumQuantityValidationLabel\":\"Minimum quantity not selected for: {{section_name}}!\",\"volumeDiscountAppliesOnSubscription\":true,\"dynamicBundleDiscountCombinedWithProductDiscount\":true,\"buyXGetYAnyNumberOfGiftProductLabel\":\"Choose any number of gift products\",\"descriptionLength\":200,\"bundleDiscountNote\":\"Discounts will be applied at checkout.\",\"bundleModalCloseRewardsLabel\":\"Close all rewards\",\"dockbarCurrentRewardLabel\":\"You got {{discount_amount}}{{discount_type}} discount\",\"productDetailsAddToBundleLabel\":\"Add to bundle\",\"cartAndCheckoutQuantityValidationMessage\":\"Orders must match the quantity range: Min {{min_quantity}}, Max {{max_quantity}}\",\"bundleNoProductSelectedLabel\":\"No product selected\",\"checkoutInfoLabel\":\"Add products from each section to enable the add to cart button.\",\"enableShowMultipleImages\":false,\"redirectToCartPageOnCartIconClick\":true,\"freeShippingDiscountCodeText\":\"FREE_SHIPPING_{{bundle_id}}\",\"customOfferLinkButtonLabel\":\"Explore Offers\",\"oneTimePurchaseLabel\":\"One Time Purchase\",\"bundleMaximumOrderAmountLabel\":\"Add maximum {{maximum_amount}} order amount\",\"enableBundleProductAscOrderView\":true,\"productAddedToBundleNotificationTitle\":\"Added to bundle\",\"showClassicBundleProductVariant\":false,\"customHtmlInject\":\"[]\",\"breadCrumbReviewSectionLabel\":\"Review Section\"}","bundleTopHtml":"","bundleBottomHtml":"","proceedToCheckoutButtonText":"","chooseProductsText":"Products","productAddToBundleLabel":"Add","productDetailsAddToBundleLabel":"Add to bundle","productDetailsMaximumDescriptionCount":300,"variantSelectionDropDownLabel":"Variants","sellingPlanSelectionDropDownLabel":"Purchase Options","dockbarHeadingLabel":"Bundle","dockbarCurrentRewardLabel":"You got {{discount_amount}}{{discount_type}} discount","dockbarDescriptionLabel":"You're getting the most rewards!","bundleModalHeaderLabel":"Your Bundle({{total_quantity}})","bundleModalShowRewardsLabel":"Show all rewards","bundleModalCloseRewardsLabel":"Close all rewards","bundleQuantityRewardsLabel":"Add {{quantity}} item, get {{discount}}{{discount_type}} discount","bundleSpentAmountRewardsLabel":"Spent {{spent_amount}} worth of items, get {{discount}}{{discount_type}} discount","bundleQuantityLabel":"{{quantity}}x","bundleSubtotalLabel":"Subtotal","bundleDiscountLabel":"Discount","bundleTotalLabel":"Total","bundleCheckoutLabel":"Checkout","bundleMinimumQuantityLabel":"Add minimum {{minimum_quantity}} product","bundleMaximumQuantityLabel":"Add maximum up to {{maximum_quantity}} product","bundleMinimumOrderAmountLabel":"Add minimum {{minimum_amount}} order amount","oneTimePurchaseLabel":"One Time Purchase","noItemsInBundle":"No items added to the bundle","modalOpenOnAddToCart":true,"productAddedToBundleNotificationTitle":"Added to bundle","productAddedToBundleNotificationDescription":"{{product_title}} added to bundle.","chooseAPlanLabel":"Choose Plan","nextButtonLabel":"Next Step","previousButtonLabel":"Previous Step","chooseSourceProductValidationLabel":"Please choose source product!","chooseAssociatedProductsValidationLabel":"Please choose associated products!","choosePlanButtonLabel":"Choose Plan","selectedSourceProductLabel":"Selected","noSourceProductSelectedLabel":"No source product selected.","reviewOrderLabel":"Review Bundle","reviewOrderDescription":"Check your items and select your required frequency plan","reviewOrderProductsLabel":"Bundle Products","reviewOrderInfoLabel":"","orderNoteLabel":"Order Note","selectedProgressLabelText":"{{total_bundle_items}} item added with a minimum quantity of {{minimum_quantity}}","availableOnlySubscriptionLabel":"Available Only On Subscription","subscriptionAvailableLabel":"Subscription Available","oneTimeOnlyLabel":"One time only","switchOnTimeLabel":"One Time","switchSubscriptionLabel":"Subscribe & Save","breadCrumbPlanLabel":"Select Plan","breadCrumbProductsLabel":"Choose Products","breadCrumbReviewBundleLabel":"Review Bundle","showDescriptionPopup":true,"tieredDiscountLabel":"{{discount_amount}}{{discount_type}}
Discount","emptyProductImage":"https://cdn.shopify.com/s/files/1/0661/9224/4900/files/EmptyImage.jpg?v=1718447038","outOfStockLabel":"Out Of Stock","notApplicableForOneTimeNotificationTitle":"Not applicable for one time","notApplicableForSubscribeAndSaveNotificationTitle":"Not applicable for subscribe & save","disableProductDescription":false,"descriptionLength":200,"readLessText":"Read Less","readMoreText":"Read More","bundleNoProductSelectedLabel":"No product selected","customHtmlInject":"[]","bundleDetailsLabel":"Your bundle:","bundleDiscountNote":"Discounts will be applied at checkout.","fixedDiscountText":"Enjoy a fixed discount of {{currency}}{{discount_value}} on your purchase!","percentDiscountText":"Get {{discount_value}}% off on your purchase!","hideVariantSelectLabel":false,"hidePurchaseOptionSelectLabel":false,"primaryColor":"#000000","primaryTextColor":"#000000","secondaryTextColor":"#ffffff","primaryHoverColor":"#000000","primaryDisabledColor":"#333333","primaryDisabledTextColor":"#ffffff","fieldDisabledBackgroundColor":"#D1D5DB","disabledTextColor":"#6B7280","volumeDiscountSaveRewardsLabel":"Save {{discount}}{{discount_type}}!","volumeDiscountQuantityRewardsLabel":"Buy {{quantity}} quantity and get {{discount}}{{discount_type}} discount!","volumeDiscountSpentAmountRewardsLabel":"Spend {{currency}}{{spent_amount}} and get {{discount}}{{discount_type}} discount!","volumeDiscountAppliedQuantityRewardsLabel":"Applied: buy {{quantity}} get {{discount}}{{discount_type}}","volumeDiscountAppliedSpentAmountRewardsLabel":"Applied: spend {{spent_amount}}{{currency}} get {{discount}}{{discount_type}}","volumeDiscountNextApplicableQuantityRewardsLabel":"Buy {{quantity}} get {{discount}}{{discount_type}}","volumeDiscountNextApplicableSpentAmountRewardsLabel":"Spend {{spent_amount}}{{currency}} get {{discount}}{{discount_type}}","addingProductsToBundle":"Adding products to bundle","freeShippingLabel":"Free Shipping","requiredBundleProductLabel":"Your bundle needs {{min_product_count}} more item(s).","enableProductDetailButton":false,"requiredLoginValidationLabel":"Please log in to purchase this bundle!","bundleNotEligibleLabel":"You're not eligible to purchase this bundle!","loginAlertTextLabel":"You need to login to purchase this bundle.","loginAlertLinkLabel":"Click here to login","customSignInLink":"","shippingDiscountLabel":"{{discount}}{{discount_type}} Shipping Discount","classicBundleDescriptionLabel":"Your bundle contains the following products.","singleParentProductDirectRedirectToChildProducts":true,"buyXGetYFixedDiscountText":"Enjoy a fixed discount of {{discount_value}} {{currency}}","buyXGetYPercentDiscountText":"Enjoy a percentage discount of {{discount_value}}%","buyXGetYFreeGiftDiscountText":"Enjoy the free product","buyXGetYAddToCartLabel":"Add to cart","buyXGetYFreeLabel":"Free","disableDiscountedPricingRedirectToCart":false,"nonListedProductText":"Non-Listed","preventClickableProductsOnCart":false,"buyXGetYChooseProductLabel":"Choose Product","showSubscriptionPlanDescription":false,"volumeAmountDiscountSaveRewardsLabel":"Save {{currency}}{{discount}}!","volumeAmountDiscountQuantityRewardsLabel":"Buy {{quantity}} quantity and get {{currency}}{{discount}} discount!","volumeAmountDiscountSpentAmountRewardsLabel":"Spend {{currency}}{{spent_amount}} and get {{currency}}{{discount}} discount!","enableManualBundleBlockIntegration":false,"cartAndCheckoutQuantityValidationMessage":"Orders must match the quantity range: Min {{min_quantity}}, Max {{max_quantity}}","dynamicBundleDiscountCodeText":"BUNDLE_DISCOUNT_{{bundle_id}}","discountUsageLimitExceedLabel":"You have exceeded the bundle usage limit","disableViewShopifyProduct":null,"redirectToCartPageOnCartIconClick":true,"sectionLabel":"Section","chooseSectionLabel":"Choose Section","chooseSectionProductsLabel":"Choose Section Products","breadCrumbSelectSectionLabel":"Select Section","breadCrumbReviewSectionLabel":"Review Section","checkoutInfoLabel":"Add products from each section to enable the add to cart button.","sectionNoProductSelectedValidationLabel":"No product selected for: {{section_name}}!","sectionMinimumQuantityValidationLabel":"Minimum quantity not selected for: {{section_name}}!","sectionMaximumQuantityValidationLabel":"Maximum quantity not selected for: {{section_name}}!","dynamicBundleDiscountCombinedWithProductDiscount":true,"dynamicBundleDiscountCombinedWithShippingDiscount":true,"dynamicBundleDiscountCombinedWithOrderDiscount":true,"volumeDiscountCombinedWithProductDiscount":true,"volumeDiscountCombinedWithShippingDiscount":true,"volumeDiscountCombinedWithOrderDiscount":true,"productDiscountCombinedWithProductDiscount":true,"productDiscountCombinedWithShippingDiscount":true,"productDiscountCombinedWithOrderDiscount":true,"buyXGetYDiscountCombinedWithProductDiscount":true,"buyXGetYDiscountCombinedWithShippingDiscount":true,"buyXGetYDiscountCombinedWithOrderDiscount":true,"shippingDiscountCombinedWithProductDiscount":true,"shippingDiscountCombinedWithOrderDiscount":true,"showDynamicBundleOrderNote":false,"bundleMaximumOrderAmountLabel":"Add maximum {{maximum_amount}} order amount","buyXGetYQuantityValidationLabel":"Add {{product_quantity}} quantities of the gift product (Get Y)","selectedGiftProductProgressLabelText":"{{selected_product_quantity}} gift products added, The required quantity is {{required_product_quantity}}","draftBundlePageTitle":"Oops! This bundle is temporarily unavailable.","draftBundlePageSubTitle":"In the meantime, check out our latest offers and discounts!","customOfferLink":"collections/all","customOfferLinkButtonLabel":"Explore Offers","enableParentProductDetailButton":false,"sectionTotalLabel":"Section Total","skipSelectSectionPage":false,"buyXGetYGiftProductPriceVisibilityType":"UNIT_PRICE","defaultSelectedPurchaseOptionSwitch":null,"defaultSelectedPurchaseOption":null,"discountTargetType":"VARIANT","enableShowMultipleImages":false,"buyXGetYAnyNumberOfGiftProductLabel":"Choose any number of gift products","showDiscountToNonEligibleCustomers":false,"dynamicBundleDiscountRecurringCycleLimit":0,"dynamicBundleDiscountAppliesOnOneTimePurchase":true,"dynamicBundleDiscountAppliesOnSubscription":true,"volumeDiscountRecurringCycleLimit":0,"volumeDiscountAppliesOnOneTimePurchase":true,"volumeDiscountAppliesOnSubscription":true,"productDiscountRecurringCycleLimit":0,"productDiscountAppliesOnOneTimePurchase":true,"productDiscountAppliesOnSubscription":true,"buyXGetYDiscountRecurringCycleLimit":0,"buyXGetYDiscountAppliesOnOneTimePurchase":true,"buyXGetYDiscountAppliesOnSubscription":true,"shippingDiscountRecurringCycleLimit":0,"shippingDiscountAppliesOnOneTimePurchase":true,"shippingDiscountAppliesOnSubscription":true,"buyXNoProductSelectedLabel":"No product selected (Buy X)","getYNoProductSelectedLabel":"No gift product selected (Get Y)","buyXQuantityValidationLabel":"Add {{product_quantity}} quantities of the product (Bux X)","buyXAnyNumberOfProductChooseLabel":"Choose any number of products","freeShippingDiscountCodeText":"FREE_SHIPPING_{{bundle_id}}","includedSubscriptionPlans":"","excludeSubscriptionPlans":"","enableBuyXGetYWidgetMergeAsOptions":false,"buyXGetYMergedWidgetTitle":"Select Buy X Get Y Discount","showClassicBundleProductVariant":false,"showProductPerPage":50,"loadMoreButtonLabel":"Load More","enableBundleProductAscOrderView":true,"cartAndCheckoutMandatoryProductValidationMessage":"This bundle or discount must include all required products and they cannot be removed.","sellingPlanNameSortOrder":"ASC","showVendorName":null,"disableFitImage":false,"enableAutoRemoveRelevantBundleItemInCart":false,"enableBundleProductFilter":null,"productFilterConfig":"{\"enabled\":false,\"filters\":[]}","enableMaxDiscountCap":null,"maxDiscountCapValue":null,"classicBundleLinkLabel":"Go to the Classic Bundle","showPriceAsDecimals":false,"showClassicBundleWidgetInChildProduct":false,"showOutOfStockProduct":true,"showDraftProduct":false,"totalBundleProductsAddedLabel":"{{total_bundle_items}} Products Added","bundleProductsQuantityLabel":"{{quantity}}x quantity","showUnitPrice":false,"productDetailsViewType":"SHOW_PRODUCT_POPUP","disableRefreshSellingPlan":false,"enableShippingDiscountBar":null,"enableVolumeDiscountBar":null,"defaultDiscountBarMessage":"Welcome to our store","discountMessageInterval":3000,"addedBundleToTheCart":null,"disabledSellingPlanSelectionValidation":false,"volumeDiscountVariantSelectLabel":"Denominations","enableScrollingToBundleSection":false}; _ABConfig.enabledSubscription = true; _ABConfig.enableValidateDiscountQuantity = false; _ABConfig.customerId = null; _ABConfig.customerName = ''; _ABConfig.firstName = ''; _ABConfig.lastName = ''; _ABConfig.customerEmail = null; _ABConfig.customerTags = []; _ABConfig.customerDiscountUsage = []; _ABConfig.shop = "3a399b-4.myshopify.com"; _ABConfig.shopMoneyFormat = "${{amount}}"; _ABConfig.shopMoneyFormatWithCurrencyFormat = "${{amount}} USD"; const currentPath = "/pages/wholesale"; if (currentPath?.includes('/collections')) _ABConfig.isCollectionPage = true; if (currentPath === '/') _ABConfig.isHomePage = true; _ABConfig.loadBundleAssets = () => { const css = "https://bundles-admin.appstle.com/content/build-a-box.css?v=1755762594062"; const js = "https://bundles-admin.appstle.com/app/build-a-box.bundle.js?v=1755762594062"; const link = document.createElement('link'); link.rel = 'stylesheet'; link.href = css; document.head.appendChild(link); const script = document.createElement('script'); script.defer = true; script.src = js; document.head.appendChild(script); }; window._ABConfig.getProductDiscountedPricing = ({ variantId, amount, quantity, sellingPlanId }) => { console.log("Executed DiscountBundlesByBundleType"); if (!variantId) { console.error('Please provide a current variant id'); return []; } //helper functions const isDiscountUsageLimitExceed = (customerDiscountUsage, bundle) => { if (customerDiscountUsage && customerDiscountUsage.length) { const targetDiscountUsage = customerDiscountUsage.find( (discountUsage) => discountUsage?.uniqueRef === bundle?.uniqueRef ); return targetDiscountUsage && targetDiscountUsage?.usageCount >= bundle?.limitToUsePerCustomer; } return false; }; const isBundleRestrictedCustomerByTagsByDiscount = (item, customerTags) => { if (!item?.restrictTags) return false; const restrictTags = item?.restrictTags?.split(','); return customerTags && customerTags.length > 0 && customerTags.some((tag) => restrictTags?.includes(tag)); }; const isBundleAllowedByCustomersTagByDiscount = (item, customerTags) => { if (!item?.allowedTags) return true; const allowedCustomersOnly = item?.allowedTags?.split(','); return ( customerTags && customerTags.length > 0 && customerTags.some((tag) => allowedCustomersOnly?.includes(tag)) ); }; const isBundleRestrictedByDiscount = (item, customerTags) => { return isBundleRestrictedCustomerByTagsByDiscount(item, customerTags) || !isBundleAllowedByCustomersTagByDiscount(item, customerTags); }; const processBundleRules = (bundles, type, fields) => bundles .filter((bundle) => bundle?.bundleType === type) .map((rule) => { const parsedRule = { ...rule }; fields.forEach((field) => { parsedRule[field] = JSON.parse(rule[field]); }); return parsedRule; }); const getBestDiscount = (applicableDiscounts, lineItem, discountKey = 'discount') => { return applicableDiscounts.reduce((greater, current) => { const greaterDiscount = greater?.[discountKey]; const currentDiscount = current?.[discountKey]; if ((greater?.discountType === "PERCENTAGE" && current?.discountType === "PERCENTAGE") || (greater?.discountType === "FIXED_AMOUNT" && current?.discountType === "FIXED_AMOUNT")) { return currentDiscount > greaterDiscount ? current : greater; } else if (current?.discountType === "FIXED_AMOUNT" && greater?.discountType === "PERCENTAGE") { return currentDiscount > ((greaterDiscount / 100) * lineItem?.totalAmount) ? current : greater; } else if (current?.discountType === "PERCENTAGE" && greater?.discountType === "FIXED_AMOUNT") { return ((currentDiscount / 100) * lineItem?.totalAmount) > greaterDiscount ? current : greater; } return currentDiscount > greaterDiscount ? current : greater; }); }; const getApplicableTieredDiscount = (volumeDiscountBundles, lineItem) => { let applicableDiscount = null; const updatedVolumeDiscountBundles = volumeDiscountBundles.map(bundle => { const updatedTieredDiscount = bundle?.tieredDiscount.map(discount => { return { ...discount, appliesOn: bundle?.appliesOn }; }) return { ...bundle, tieredDiscount: updatedTieredDiscount } }); const volumeDiscountBundlesTieredDiscount = updatedVolumeDiscountBundles.reduce((acc, item) => { return acc.concat(item?.tieredDiscount); }, []); let applicableQuantityBasedDiscount = volumeDiscountBundlesTieredDiscount .filter(tieredDiscount => tieredDiscount?.discountBasedOn === "QUANTITY") .filter(tieredDiscount => lineItem?.quantity >= tieredDiscount?.value); applicableQuantityBasedDiscount = applicableQuantityBasedDiscount.length > 0 ? getBestDiscount(applicableQuantityBasedDiscount, lineItem) : null; let applicableSpendAmountBasedDiscount = volumeDiscountBundlesTieredDiscount .filter(tieredDiscount => tieredDiscount?.discountBasedOn === "AMOUNT") .filter(tieredDiscount => lineItem?.totalAmount >= tieredDiscount?.value); applicableSpendAmountBasedDiscount = applicableSpendAmountBasedDiscount.length > 0 ? getBestDiscount(applicableSpendAmountBasedDiscount, lineItem, ) : null; if (applicableQuantityBasedDiscount && applicableSpendAmountBasedDiscount) { if ((applicableQuantityBasedDiscount?.discountType === "PERCENTAGE" && applicableSpendAmountBasedDiscount?.discountType === "PERCENTAGE") || (applicableQuantityBasedDiscount?.discountType === "FIXED_AMOUNT" && applicableSpendAmountBasedDiscount?.discountType === "FIXED_AMOUNT")) { if (applicableQuantityBasedDiscount?.discount > applicableSpendAmountBasedDiscount?.discount) { applicableDiscount = applicableQuantityBasedDiscount; } else { applicableDiscount = applicableSpendAmountBasedDiscount; } }else if(applicableQuantityBasedDiscount?.discountType === "PERCENTAGE" && applicableSpendAmountBasedDiscount?.discountType === "FIXED_AMOUNT"){ if (((applicableQuantityBasedDiscount?.discount / 100) * lineItem?.totalAmount) > applicableSpendAmountBasedDiscount?.discount) { applicableDiscount = applicableQuantityBasedDiscount; } else { applicableDiscount = applicableSpendAmountBasedDiscount; } }else if(applicableQuantityBasedDiscount?.discountType === "FIXED_AMOUNT" && applicableSpendAmountBasedDiscount?.discountType === "PERCENTAGE"){ if (applicableQuantityBasedDiscount?.discount > ((applicableSpendAmountBasedDiscount?.discount / 100) * lineItem?.totalAmount)) { applicableDiscount = applicableQuantityBasedDiscount; } else { applicableDiscount = applicableSpendAmountBasedDiscount; } } } else if (applicableQuantityBasedDiscount) { applicableDiscount = applicableQuantityBasedDiscount; } else if (applicableSpendAmountBasedDiscount) { applicableDiscount = applicableSpendAmountBasedDiscount; } return applicableDiscount; } const getApplicablePercentOrFixedDiscount = (discountedPricingBundles, lineItem) => { let applicableDiscount = null; let applicableQuantityBasedDiscount = discountedPricingBundles .map(bundle => { return { ...bundle, minProductCount: bundle?.minProductCount || 0, maxProductCount: bundle?.maxProductCount || 0, minOrderAmount: bundle?.minOrderAmount || 0 }; }) .filter(bundle => { const minCount = bundle.minProductCount; const maxCount = bundle.maxProductCount; const minAmount = bundle.minOrderAmount; if (minCount > 0 && lineItem.quantity < minCount) return false; if (maxCount > 0 && lineItem.quantity > maxCount) return false; if (minAmount > 0 && lineItem.amount < minAmount) return false; return true; }); applicableDiscount = applicableQuantityBasedDiscount.length > 0 ? getBestDiscount(applicableQuantityBasedDiscount, lineItem, 'discountValue') : null; if(applicableDiscount){ applicableDiscount = { discountBasedOn: applicableDiscount?.minOrderAmount > 0 && applicableDiscount?.minProductCount === 0 ? "AMOUNT" : "QUANTITY", value: applicableDiscount?.minOrderAmount > 0 && applicableDiscount?.minProductCount === 0 ? lineItem?.totalAmount : lineItem?.quantity, discount: applicableDiscount?.discountValue, discountType: applicableDiscount?.discountType, appliesOn: applicableDiscount?.appliesOn } } return applicableDiscount; } const discountBundles = []; const customerTags = null; let customerDiscountUsage = []; let isLoggedIn = false; const filteredDiscountBundles = Array.isArray(discountBundles) && discountBundles.length > 0 && discountBundles?.filter((bundle) => { if (bundle?.status !== 'ACTIVE') { return false; } if ((bundle?.allowedTags || bundle?.restrictTags || bundle?.limitToUsePerCustomer > 0) && !isLoggedIn) { return false; } if ((bundle?.allowedTags || bundle?.restrictTags) && isLoggedIn && isBundleRestrictedByDiscount(bundle, customerTags)) { return false; } if (bundle?.limitToUsePerCustomer > 0 && isDiscountUsageLimitExceed(customerDiscountUsage, bundle)) { return false; } if (bundle?.appliesOn === "ONE_TIME" && sellingPlanId != null) { return false; } if (bundle?.appliesOn === "SUBSCRIPTION" && sellingPlanId === null) { return false; } try { const variants = JSON.parse(bundle?.variants || '[]'); return variants.some((variant) => parseInt(variant?.variantId) === parseInt(variantId)); } catch (e) { console.error('Failed to parse JSON:', e); return false; } }) || []; const totalAmount = amount * quantity; const lineItem = {variantId, quantity, amount, totalAmount }; const volumeDiscountBundles = processBundleRules(filteredDiscountBundles, 'VOLUME_DISCOUNT', ["variants", "tieredDiscount"]); const discountedPricingBundles = processBundleRules(filteredDiscountBundles, 'DISCOUNTED_PRICING', ["variants"]); let applicableDiscount = null; const volumeDiscount = getApplicableTieredDiscount(volumeDiscountBundles, lineItem); const pricingDiscount = getApplicablePercentOrFixedDiscount(discountedPricingBundles, lineItem); if (volumeDiscount && pricingDiscount) { applicableDiscount = getBestDiscount([volumeDiscount, pricingDiscount], lineItem); } else { applicableDiscount = volumeDiscount || pricingDiscount; } const discountAmount = applicableDiscount?.discountType === "PERCENTAGE" ? (totalAmount * applicableDiscount?.discount) / 100 : applicableDiscount?.discount; const discountedPrice = applicableDiscount?.discountType === "PERCENTAGE" ? (totalAmount - discountAmount) : ( totalAmount - applicableDiscount?.discount); return { variantId, quantity, amount, totalAmount, discountType: applicableDiscount?.discountType, discountValue: applicableDiscount?.discount, discountAmount, discountedPrice: !isNaN(discountedPrice) ? discountedPrice : undefined, discountConfigure: applicableDiscount?.appliesOn }; };
Discount","emptyProductImage":"https://cdn.shopify.com/s/files/1/0661/9224/4900/files/EmptyImage.jpg?v=1718447038","outOfStockLabel":"Out Of Stock","notApplicableForOneTimeNotificationTitle":"Not applicable for one time","notApplicableForSubscribeAndSaveNotificationTitle":"Not applicable for subscribe & save","disableProductDescription":false,"descriptionLength":200,"readLessText":"Read Less","readMoreText":"Read More","bundleNoProductSelectedLabel":"No product selected","customHtmlInject":"[]","bundleDetailsLabel":"Your bundle:","bundleDiscountNote":"Discounts will be applied at checkout.","fixedDiscountText":"Enjoy a fixed discount of {{currency}}{{discount_value}} on your purchase!","percentDiscountText":"Get {{discount_value}}% off on your purchase!","hideVariantSelectLabel":false,"hidePurchaseOptionSelectLabel":false,"primaryColor":"#000000","primaryTextColor":"#000000","secondaryTextColor":"#ffffff","primaryHoverColor":"#000000","primaryDisabledColor":"#333333","primaryDisabledTextColor":"#ffffff","fieldDisabledBackgroundColor":"#D1D5DB","disabledTextColor":"#6B7280","volumeDiscountSaveRewardsLabel":"Save {{discount}}{{discount_type}}!","volumeDiscountQuantityRewardsLabel":"Buy {{quantity}} quantity and get {{discount}}{{discount_type}} discount!","volumeDiscountSpentAmountRewardsLabel":"Spend {{currency}}{{spent_amount}} and get {{discount}}{{discount_type}} discount!","volumeDiscountAppliedQuantityRewardsLabel":"Applied: buy {{quantity}} get {{discount}}{{discount_type}}","volumeDiscountAppliedSpentAmountRewardsLabel":"Applied: spend {{spent_amount}}{{currency}} get {{discount}}{{discount_type}}","volumeDiscountNextApplicableQuantityRewardsLabel":"Buy {{quantity}} get {{discount}}{{discount_type}}","volumeDiscountNextApplicableSpentAmountRewardsLabel":"Spend {{spent_amount}}{{currency}} get {{discount}}{{discount_type}}","addingProductsToBundle":"Adding products to bundle","freeShippingLabel":"Free Shipping","requiredBundleProductLabel":"Your bundle needs {{min_product_count}} more item(s).","enableProductDetailButton":false,"requiredLoginValidationLabel":"Please log in to purchase this bundle!","bundleNotEligibleLabel":"You're not eligible to purchase this bundle!","loginAlertTextLabel":"You need to login to purchase this bundle.","loginAlertLinkLabel":"Click here to login","customSignInLink":"","shippingDiscountLabel":"{{discount}}{{discount_type}} Shipping Discount","classicBundleDescriptionLabel":"Your bundle contains the following products.","singleParentProductDirectRedirectToChildProducts":true,"buyXGetYFixedDiscountText":"Enjoy a fixed discount of {{discount_value}} {{currency}}","buyXGetYPercentDiscountText":"Enjoy a percentage discount of {{discount_value}}%","buyXGetYFreeGiftDiscountText":"Enjoy the free product","buyXGetYAddToCartLabel":"Add to cart","buyXGetYFreeLabel":"Free","disableDiscountedPricingRedirectToCart":false,"nonListedProductText":"Non-Listed","preventClickableProductsOnCart":false,"buyXGetYChooseProductLabel":"Choose Product","showSubscriptionPlanDescription":false,"volumeAmountDiscountSaveRewardsLabel":"Save {{currency}}{{discount}}!","volumeAmountDiscountQuantityRewardsLabel":"Buy {{quantity}} quantity and get {{currency}}{{discount}} discount!","volumeAmountDiscountSpentAmountRewardsLabel":"Spend {{currency}}{{spent_amount}} and get {{currency}}{{discount}} discount!","enableManualBundleBlockIntegration":false,"cartAndCheckoutQuantityValidationMessage":"Orders must match the quantity range: Min {{min_quantity}}, Max {{max_quantity}}","dynamicBundleDiscountCodeText":"BUNDLE_DISCOUNT_{{bundle_id}}","discountUsageLimitExceedLabel":"You have exceeded the bundle usage limit","disableViewShopifyProduct":null,"redirectToCartPageOnCartIconClick":true,"sectionLabel":"Section","chooseSectionLabel":"Choose Section","chooseSectionProductsLabel":"Choose Section Products","breadCrumbSelectSectionLabel":"Select Section","breadCrumbReviewSectionLabel":"Review Section","checkoutInfoLabel":"Add products from each section to enable the add to cart button.","sectionNoProductSelectedValidationLabel":"No product selected for: {{section_name}}!","sectionMinimumQuantityValidationLabel":"Minimum quantity not selected for: {{section_name}}!","sectionMaximumQuantityValidationLabel":"Maximum quantity not selected for: {{section_name}}!","dynamicBundleDiscountCombinedWithProductDiscount":true,"dynamicBundleDiscountCombinedWithShippingDiscount":true,"dynamicBundleDiscountCombinedWithOrderDiscount":true,"volumeDiscountCombinedWithProductDiscount":true,"volumeDiscountCombinedWithShippingDiscount":true,"volumeDiscountCombinedWithOrderDiscount":true,"productDiscountCombinedWithProductDiscount":true,"productDiscountCombinedWithShippingDiscount":true,"productDiscountCombinedWithOrderDiscount":true,"buyXGetYDiscountCombinedWithProductDiscount":true,"buyXGetYDiscountCombinedWithShippingDiscount":true,"buyXGetYDiscountCombinedWithOrderDiscount":true,"shippingDiscountCombinedWithProductDiscount":true,"shippingDiscountCombinedWithOrderDiscount":true,"showDynamicBundleOrderNote":false,"bundleMaximumOrderAmountLabel":"Add maximum {{maximum_amount}} order amount","buyXGetYQuantityValidationLabel":"Add {{product_quantity}} quantities of the gift product (Get Y)","selectedGiftProductProgressLabelText":"{{selected_product_quantity}} gift products added, The required quantity is {{required_product_quantity}}","draftBundlePageTitle":"Oops! This bundle is temporarily unavailable.","draftBundlePageSubTitle":"In the meantime, check out our latest offers and discounts!","customOfferLink":"collections/all","customOfferLinkButtonLabel":"Explore Offers","enableParentProductDetailButton":false,"sectionTotalLabel":"Section Total","skipSelectSectionPage":false,"buyXGetYGiftProductPriceVisibilityType":"UNIT_PRICE","defaultSelectedPurchaseOptionSwitch":null,"defaultSelectedPurchaseOption":null,"discountTargetType":"VARIANT","enableShowMultipleImages":false,"buyXGetYAnyNumberOfGiftProductLabel":"Choose any number of gift products","showDiscountToNonEligibleCustomers":false,"dynamicBundleDiscountRecurringCycleLimit":0,"dynamicBundleDiscountAppliesOnOneTimePurchase":true,"dynamicBundleDiscountAppliesOnSubscription":true,"volumeDiscountRecurringCycleLimit":0,"volumeDiscountAppliesOnOneTimePurchase":true,"volumeDiscountAppliesOnSubscription":true,"productDiscountRecurringCycleLimit":0,"productDiscountAppliesOnOneTimePurchase":true,"productDiscountAppliesOnSubscription":true,"buyXGetYDiscountRecurringCycleLimit":0,"buyXGetYDiscountAppliesOnOneTimePurchase":true,"buyXGetYDiscountAppliesOnSubscription":true,"shippingDiscountRecurringCycleLimit":0,"shippingDiscountAppliesOnOneTimePurchase":true,"shippingDiscountAppliesOnSubscription":true,"buyXNoProductSelectedLabel":"No product selected (Buy X)","getYNoProductSelectedLabel":"No gift product selected (Get Y)","buyXQuantityValidationLabel":"Add {{product_quantity}} quantities of the product (Bux X)","buyXAnyNumberOfProductChooseLabel":"Choose any number of products","freeShippingDiscountCodeText":"FREE_SHIPPING_{{bundle_id}}","includedSubscriptionPlans":"","excludeSubscriptionPlans":"","enableBuyXGetYWidgetMergeAsOptions":false,"buyXGetYMergedWidgetTitle":"Select Buy X Get Y Discount","showClassicBundleProductVariant":false,"showProductPerPage":50,"loadMoreButtonLabel":"Load More","enableBundleProductAscOrderView":true,"cartAndCheckoutMandatoryProductValidationMessage":"This bundle or discount must include all required products and they cannot be removed.","sellingPlanNameSortOrder":"ASC","showVendorName":null,"disableFitImage":false,"enableAutoRemoveRelevantBundleItemInCart":false,"enableBundleProductFilter":null,"productFilterConfig":"{\"enabled\":false,\"filters\":[]}","enableMaxDiscountCap":null,"maxDiscountCapValue":null,"classicBundleLinkLabel":"Go to the Classic Bundle","showPriceAsDecimals":false,"showClassicBundleWidgetInChildProduct":false,"showOutOfStockProduct":true,"showDraftProduct":false,"totalBundleProductsAddedLabel":"{{total_bundle_items}} Products Added","bundleProductsQuantityLabel":"{{quantity}}x quantity","showUnitPrice":false,"productDetailsViewType":"SHOW_PRODUCT_POPUP","disableRefreshSellingPlan":false,"enableShippingDiscountBar":null,"enableVolumeDiscountBar":null,"defaultDiscountBarMessage":"Welcome to our store","discountMessageInterval":3000,"addedBundleToTheCart":null,"disabledSellingPlanSelectionValidation":false,"volumeDiscountVariantSelectLabel":"Denominations","enableScrollingToBundleSection":false}; _ABConfig.enabledSubscription = true; _ABConfig.enableValidateDiscountQuantity = false; _ABConfig.customerId = null; _ABConfig.customerName = ''; _ABConfig.firstName = ''; _ABConfig.lastName = ''; _ABConfig.customerEmail = null; _ABConfig.customerTags = []; _ABConfig.customerDiscountUsage = []; _ABConfig.shop = "3a399b-4.myshopify.com"; _ABConfig.shopMoneyFormat = "${{amount}}"; _ABConfig.shopMoneyFormatWithCurrencyFormat = "${{amount}} USD"; const currentPath = "/pages/wholesale"; if (currentPath?.includes('/collections')) _ABConfig.isCollectionPage = true; if (currentPath === '/') _ABConfig.isHomePage = true; _ABConfig.loadBundleAssets = () => { const css = "https://bundles-admin.appstle.com/content/build-a-box.css?v=1755762594062"; const js = "https://bundles-admin.appstle.com/app/build-a-box.bundle.js?v=1755762594062"; const link = document.createElement('link'); link.rel = 'stylesheet'; link.href = css; document.head.appendChild(link); const script = document.createElement('script'); script.defer = true; script.src = js; document.head.appendChild(script); }; window._ABConfig.getProductDiscountedPricing = ({ variantId, amount, quantity, sellingPlanId }) => { console.log("Executed DiscountBundlesByBundleType"); if (!variantId) { console.error('Please provide a current variant id'); return []; } //helper functions const isDiscountUsageLimitExceed = (customerDiscountUsage, bundle) => { if (customerDiscountUsage && customerDiscountUsage.length) { const targetDiscountUsage = customerDiscountUsage.find( (discountUsage) => discountUsage?.uniqueRef === bundle?.uniqueRef ); return targetDiscountUsage && targetDiscountUsage?.usageCount >= bundle?.limitToUsePerCustomer; } return false; }; const isBundleRestrictedCustomerByTagsByDiscount = (item, customerTags) => { if (!item?.restrictTags) return false; const restrictTags = item?.restrictTags?.split(','); return customerTags && customerTags.length > 0 && customerTags.some((tag) => restrictTags?.includes(tag)); }; const isBundleAllowedByCustomersTagByDiscount = (item, customerTags) => { if (!item?.allowedTags) return true; const allowedCustomersOnly = item?.allowedTags?.split(','); return ( customerTags && customerTags.length > 0 && customerTags.some((tag) => allowedCustomersOnly?.includes(tag)) ); }; const isBundleRestrictedByDiscount = (item, customerTags) => { return isBundleRestrictedCustomerByTagsByDiscount(item, customerTags) || !isBundleAllowedByCustomersTagByDiscount(item, customerTags); }; const processBundleRules = (bundles, type, fields) => bundles .filter((bundle) => bundle?.bundleType === type) .map((rule) => { const parsedRule = { ...rule }; fields.forEach((field) => { parsedRule[field] = JSON.parse(rule[field]); }); return parsedRule; }); const getBestDiscount = (applicableDiscounts, lineItem, discountKey = 'discount') => { return applicableDiscounts.reduce((greater, current) => { const greaterDiscount = greater?.[discountKey]; const currentDiscount = current?.[discountKey]; if ((greater?.discountType === "PERCENTAGE" && current?.discountType === "PERCENTAGE") || (greater?.discountType === "FIXED_AMOUNT" && current?.discountType === "FIXED_AMOUNT")) { return currentDiscount > greaterDiscount ? current : greater; } else if (current?.discountType === "FIXED_AMOUNT" && greater?.discountType === "PERCENTAGE") { return currentDiscount > ((greaterDiscount / 100) * lineItem?.totalAmount) ? current : greater; } else if (current?.discountType === "PERCENTAGE" && greater?.discountType === "FIXED_AMOUNT") { return ((currentDiscount / 100) * lineItem?.totalAmount) > greaterDiscount ? current : greater; } return currentDiscount > greaterDiscount ? current : greater; }); }; const getApplicableTieredDiscount = (volumeDiscountBundles, lineItem) => { let applicableDiscount = null; const updatedVolumeDiscountBundles = volumeDiscountBundles.map(bundle => { const updatedTieredDiscount = bundle?.tieredDiscount.map(discount => { return { ...discount, appliesOn: bundle?.appliesOn }; }) return { ...bundle, tieredDiscount: updatedTieredDiscount } }); const volumeDiscountBundlesTieredDiscount = updatedVolumeDiscountBundles.reduce((acc, item) => { return acc.concat(item?.tieredDiscount); }, []); let applicableQuantityBasedDiscount = volumeDiscountBundlesTieredDiscount .filter(tieredDiscount => tieredDiscount?.discountBasedOn === "QUANTITY") .filter(tieredDiscount => lineItem?.quantity >= tieredDiscount?.value); applicableQuantityBasedDiscount = applicableQuantityBasedDiscount.length > 0 ? getBestDiscount(applicableQuantityBasedDiscount, lineItem) : null; let applicableSpendAmountBasedDiscount = volumeDiscountBundlesTieredDiscount .filter(tieredDiscount => tieredDiscount?.discountBasedOn === "AMOUNT") .filter(tieredDiscount => lineItem?.totalAmount >= tieredDiscount?.value); applicableSpendAmountBasedDiscount = applicableSpendAmountBasedDiscount.length > 0 ? getBestDiscount(applicableSpendAmountBasedDiscount, lineItem, ) : null; if (applicableQuantityBasedDiscount && applicableSpendAmountBasedDiscount) { if ((applicableQuantityBasedDiscount?.discountType === "PERCENTAGE" && applicableSpendAmountBasedDiscount?.discountType === "PERCENTAGE") || (applicableQuantityBasedDiscount?.discountType === "FIXED_AMOUNT" && applicableSpendAmountBasedDiscount?.discountType === "FIXED_AMOUNT")) { if (applicableQuantityBasedDiscount?.discount > applicableSpendAmountBasedDiscount?.discount) { applicableDiscount = applicableQuantityBasedDiscount; } else { applicableDiscount = applicableSpendAmountBasedDiscount; } }else if(applicableQuantityBasedDiscount?.discountType === "PERCENTAGE" && applicableSpendAmountBasedDiscount?.discountType === "FIXED_AMOUNT"){ if (((applicableQuantityBasedDiscount?.discount / 100) * lineItem?.totalAmount) > applicableSpendAmountBasedDiscount?.discount) { applicableDiscount = applicableQuantityBasedDiscount; } else { applicableDiscount = applicableSpendAmountBasedDiscount; } }else if(applicableQuantityBasedDiscount?.discountType === "FIXED_AMOUNT" && applicableSpendAmountBasedDiscount?.discountType === "PERCENTAGE"){ if (applicableQuantityBasedDiscount?.discount > ((applicableSpendAmountBasedDiscount?.discount / 100) * lineItem?.totalAmount)) { applicableDiscount = applicableQuantityBasedDiscount; } else { applicableDiscount = applicableSpendAmountBasedDiscount; } } } else if (applicableQuantityBasedDiscount) { applicableDiscount = applicableQuantityBasedDiscount; } else if (applicableSpendAmountBasedDiscount) { applicableDiscount = applicableSpendAmountBasedDiscount; } return applicableDiscount; } const getApplicablePercentOrFixedDiscount = (discountedPricingBundles, lineItem) => { let applicableDiscount = null; let applicableQuantityBasedDiscount = discountedPricingBundles .map(bundle => { return { ...bundle, minProductCount: bundle?.minProductCount || 0, maxProductCount: bundle?.maxProductCount || 0, minOrderAmount: bundle?.minOrderAmount || 0 }; }) .filter(bundle => { const minCount = bundle.minProductCount; const maxCount = bundle.maxProductCount; const minAmount = bundle.minOrderAmount; if (minCount > 0 && lineItem.quantity < minCount) return false; if (maxCount > 0 && lineItem.quantity > maxCount) return false; if (minAmount > 0 && lineItem.amount < minAmount) return false; return true; }); applicableDiscount = applicableQuantityBasedDiscount.length > 0 ? getBestDiscount(applicableQuantityBasedDiscount, lineItem, 'discountValue') : null; if(applicableDiscount){ applicableDiscount = { discountBasedOn: applicableDiscount?.minOrderAmount > 0 && applicableDiscount?.minProductCount === 0 ? "AMOUNT" : "QUANTITY", value: applicableDiscount?.minOrderAmount > 0 && applicableDiscount?.minProductCount === 0 ? lineItem?.totalAmount : lineItem?.quantity, discount: applicableDiscount?.discountValue, discountType: applicableDiscount?.discountType, appliesOn: applicableDiscount?.appliesOn } } return applicableDiscount; } const discountBundles = []; const customerTags = null; let customerDiscountUsage = []; let isLoggedIn = false; const filteredDiscountBundles = Array.isArray(discountBundles) && discountBundles.length > 0 && discountBundles?.filter((bundle) => { if (bundle?.status !== 'ACTIVE') { return false; } if ((bundle?.allowedTags || bundle?.restrictTags || bundle?.limitToUsePerCustomer > 0) && !isLoggedIn) { return false; } if ((bundle?.allowedTags || bundle?.restrictTags) && isLoggedIn && isBundleRestrictedByDiscount(bundle, customerTags)) { return false; } if (bundle?.limitToUsePerCustomer > 0 && isDiscountUsageLimitExceed(customerDiscountUsage, bundle)) { return false; } if (bundle?.appliesOn === "ONE_TIME" && sellingPlanId != null) { return false; } if (bundle?.appliesOn === "SUBSCRIPTION" && sellingPlanId === null) { return false; } try { const variants = JSON.parse(bundle?.variants || '[]'); return variants.some((variant) => parseInt(variant?.variantId) === parseInt(variantId)); } catch (e) { console.error('Failed to parse JSON:', e); return false; } }) || []; const totalAmount = amount * quantity; const lineItem = {variantId, quantity, amount, totalAmount }; const volumeDiscountBundles = processBundleRules(filteredDiscountBundles, 'VOLUME_DISCOUNT', ["variants", "tieredDiscount"]); const discountedPricingBundles = processBundleRules(filteredDiscountBundles, 'DISCOUNTED_PRICING', ["variants"]); let applicableDiscount = null; const volumeDiscount = getApplicableTieredDiscount(volumeDiscountBundles, lineItem); const pricingDiscount = getApplicablePercentOrFixedDiscount(discountedPricingBundles, lineItem); if (volumeDiscount && pricingDiscount) { applicableDiscount = getBestDiscount([volumeDiscount, pricingDiscount], lineItem); } else { applicableDiscount = volumeDiscount || pricingDiscount; } const discountAmount = applicableDiscount?.discountType === "PERCENTAGE" ? (totalAmount * applicableDiscount?.discount) / 100 : applicableDiscount?.discount; const discountedPrice = applicableDiscount?.discountType === "PERCENTAGE" ? (totalAmount - discountAmount) : ( totalAmount - applicableDiscount?.discount); return { variantId, quantity, amount, totalAmount, discountType: applicableDiscount?.discountType, discountValue: applicableDiscount?.discount, discountAmount, discountedPrice: !isNaN(discountedPrice) ? discountedPrice : undefined, discountConfigure: applicableDiscount?.appliesOn }; };