Hogyan segítik elő a CBD csíkok a száraz, repedezett bőr gyógyulását hidegebb időben?
Hogyan segítik elő a CBD csíkok a száraz, repedezett bőr gyógyulását hidegebb időben? A CBD csíkok segítenek meggyógyítani a száraz, repedezett bőrt azáltal, hogy mélyen hidratálják és megerősítik a bőr természetes védőrétegét. Az olyan összetevők, mint a glicerin, megkötik a nedvességet, míg a CBD gyulladáscsökkentő tulajdonságai csökkentik az irritációt. A csíkok megnyugtatják és gyógyítják a sérült bőrt, visszaadják a puhaságot és a kényelmet még kemény téli körülmények között is.
IMPORTANT: This information is NOT MEDICAL ADVICE and is only provided for general informational purposes only. Always first seek the advice of your doctor or a healthcare professional first before taking a CBD product or vitamin supplement if you are unsure. Statements regarding dietary supplements have not been evaluated by the FDA and are not intended to diagnose, treat, cure, or prevent any disease or health condition. No claims are intended to be made about the functions or ability of a CBD infused cosmetic product and/ or vitamin supplement to provide any specific health or wellness benefits. None of our CBD strips, patches or other CBD products are described, promoted or marketed as having any function not listed in the COSING Information Database. Any information provided here about CBD or any other ingredient and/ or product is strictly for general informational purposes and should not be interpreted as medical, therapeutic, or diagnostic advice. CBD products are not intended to diagnose, treat, cure, or prevent any disease or health condition. You are advised to always first consult with a doctor or a qualified healthcare professional before using any CBD product, particularly if you any of the following apply. DO NOT USE CBD IF PREGANT, BREAST FEEDING OR IF YOU HAVE A SERIOUS MEDICAL CONDITION. DO NOT USE IF PACKAGING HAS BEEN OPENED DURING SHIPPING. DISCONTINUE USE IF ANY ADVERSE REACTION OR SYMPTOM OCCURS. CONTACT A DOCTOR IF REACTION OR SYMPTOM CONTINUES. FOR ADULTS ONLY. STORE OUT OF REACH OF CHILDREN.
När du gör ett urval uppdateras sidan.
Öppnas i ett nytt fönster.
(() => {
const loadAppstleBundleAssets = () => {
const css = "https://bundles-admin.appstle.com/content/volume-discount.css?v=1766561671226";
const js = "https://bundles-admin.appstle.com/app/volume-discount.bundle.js?v=1766561671226";
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);
};
const executeVolumeDiscountBlock = ({ blockElement }) => {
const discountRules = [{"id":12013,"shop":"norrgear.myshopify.com","name":"12-Packs FREE DELIVERY 20% DISCOUNT","description":"","status":"ACTIVE","customerIncludeTags":null,"discountType":"NO_DISCOUNT","discountValue":null,"products":"null","variants":"[{\"productId\":14922466754935,\"variantId\":54994986566007,\"name\":\"6000mg CBD | 120 PATCHES | 120 X 50mg CBD 0mg THC | FREE DELIVERY \",\"productHandle\":\"6000mg-cbd-120-patches-120-x-50mg-cbd-0mg-thc-free-delivery\",\"imageSrc\":\"https://cdn.shopify.com/s/files/1/0251/1559/0710/files/6000mg_CBD_120_PATCHES_120_X_50mg_CBD_0mg_THC_FREE_DELIVERY_BUY_ONLINE_O-HITS_1_ONLINE_CBD_STORE.png?v=1741528629\",\"quantity\":1,\"price\":\"384.00\",\"status\":\"ACTIVE\",\"productTitle\":\"6000mg CBD | 120 PATCHES | 120 X 50mg CBD 0mg THC | FREE DELIVERY\",\"variantTitle\":null,\"isMandatory\":false,\"preSelected\":false,\"minQuantity\":null,\"maxQuantity\":null}]","sequenceNo":null,"bundleType":"VOLUME_DISCOUNT","settings":"{\"showUnitPrice\":false,\"showPricesWithoutDecimal\":false,\"showPriceWithSubscriptionPrice\":true,\"showPriceOfChosenProductsOnly\":false}","bundleProductId":null,"bundleVariantId":null,"productHandle":null,"discountId":null,"price":null,"numberOfProducts":0,"subscriptionBundlingEnabled":false,"subscriptionId":null,"minProductCount":null,"maxProductCount":null,"uniqueRef":"D9CqE5ZP5V","bundleRedirect":"CART","customRedirectURL":null,"minOrderAmount":null,"tieredDiscount":"[{\"discountBasedOn\":\"QUANTITY\",\"value\":12,\"discount\":20.0,\"discountType\":\"PERCENTAGE\",\"discountAllowedTags\":null,\"titleLabel\":\"SAVE\"}]","productViewStyle":"QUICK_ADD","singleProductSettings":"null","trackInventory":false,"sellingPlanType":"BUNDLE_LEVEL","clearCart":"ENABLED","minPrice":null,"maxPrice":null,"externalBuildABoxId":null,"variantVisibilityType":"SHOW_VARIANTS_AS_OPTIONS","subTitle":null,"freeShipping":false,"themeType":"THEME_ONE","showBundleInProductPage":true,"combinedWithProductDiscount":true,"combinedWithShippingDiscount":true,"combinedWithOrderDiscount":true,"allowedTags":null,"restrictTags":null,"selectionType":"FLEXIBLE","bundleHtml":"null","discountedVariants":"null","allowedCountries":null,"appliesOn":"ONE_TIME","purchaseRequirement":"NO_REQUIREMENT","productDiscountType":"EACH_PRODUCT","countrySelectionType":"ALL_COUNTRY","discountApplyApproach":"SHOPIFY_DISCOUNT_FUNCTION","discountedProductChooseType":"CHOOSE_ALL","internalName":"12-Packs OFFER 15mg PATCHES","sections":"[{\"id\":1,\"name\":\"\",\"description\":\"\",\"minProductCount\":0,\"maxProductCount\":0,\"variants\":[]}]","limitToUsePerCustomer":null,"discountedVariantSelectionLimit":null,"hideOneTimePurchase":false,"hideSubscriptionPurchase":false,"maxOrderAmount":null,"collectionData":null,"productSelectionType":"PRODUCT","tag":"appstle_bundles","productChooseType":null,"variantSelectionLimit":null,"discountTargetType":"VARIANT","enableSubscription":null,"subscriptionWidgetPosition":null,"subscribeTitle":null,"subscribeSubtitle":null,"subscriptionPreselected":null,"getYAppliesOn":null,"announcementBarMessage":null,"automaticDiscountNodeId":"gid://shopify/DiscountAutomaticNode/2241920893303","recurringCycleLimit":0,"automaticShippingDiscountNodeId":null,"scheduledBundleRule":null,"bundleActiveFrom":null,"bundleActiveTo":null,"bundleSubType":null,"discountAppliesOn":"PER_LINE_ITEM","layoutType":null,"style":"{\"productCardBackgroundColor\":\"#ffffff\",\"disabledTextColor\":\"#6B7280\",\"buttonBackgroundColor\":\"#071775\",\"bundlePageBackgroundColor\":\"#FAFAF9\",\"headingTextColor\":\"#000000\",\"primaryHoverColor\":\"#000000\",\"primaryTextColor\":\"#000000\",\"primaryColor\":\"#071775\",\"primaryDisabledColor\":\"#333333\",\"primaryDisabledTextColor\":\"#99CCFF\",\"secondaryTextColor\":\"#b99c59\",\"fieldDisabledBackgroundColor\":\"#D1D5DB\"}","labels":"{}","upsells":null,"enableVolumeDiscountUpsell":false,"combos":null}];
const filteredDiscounts = Array.isArray(discountRules) && discountRules?.length > 0 && discountRules.filter((rule) => rule?.bundleType === 'VOLUME_DISCOUNT' && rule?.status === 'ACTIVE') || [];
if (filteredDiscounts?.length > 0 && blockElement) {
loadAppstleBundleAssets();
const discountDiv = document.createElement('div');
const reference = 'VOLUME_DISCOUNT';
discountDiv.setAttribute('appstle-volume-discount-unique-reference', reference);
discountDiv.className = 'appstle-volume-discount';
discountDiv.style.cssText = 'width: 100%; display: block;';
blockElement.appendChild(discountDiv);
const appBlockDiv = document.querySelector('div[data-block-handle="appstle-volume-discount-page"]');
if (appBlockDiv) {
appBlockDiv.appendChild(blockElement);
}
}
};
document.addEventListener('DOMContentLoaded', () => {
const disableAppFunctionality = window?._ABConfig?.['disableAppFunctionality'] || false;
let blockElement = document.getElementById('volumeDiscountContainer');
const blockElements = document.querySelectorAll('.ab-volume-discount-custom-placement-selector');
if (blockElement && !disableAppFunctionality) {
blockElement.innerHTML = '';
executeVolumeDiscountBlock({ blockElement });
}
blockElements?.length > 0 && !disableAppFunctionality && blockElements?.forEach(element => {
element.innerHTML = '';
executeVolumeDiscountBlock({ blockElement: element });
});
});
})();
(() => {
document.addEventListener('DOMContentLoaded', async () => {
const hasNextVolumeDiscountSelector = document.querySelectorAll('.appstle-bundle-cart-next-volume-discount-stand-alone-selector')?.length > 0;
const disableAppFunctionality = window?._ABConfig?.['disableAppFunctionality'] || false;
if (hasNextVolumeDiscountSelector && !disableAppFunctionality) {
await executeCartLogic();
setupCartMutationObserver();
}
});
const executeCartLogic = async () => {
const discountElements = document.querySelectorAll('.appstle-bundle-cart-next-volume-discount-stand-alone-selector');
const cartItems = await getShopifyCartItems();
const bundleSettings = {"id":3403,"shop":"norrgear.myshopify.com","showOnProductPage":null,"selector":null,"placement":null,"customCss":".ab-volume-name {\r\n display: none !important;\r\n}\r\n.ab-volume-discounts {\r\n margin-top: 10px !important; /* Adjust as needed */\r\n}\r\n.ab-volume-main-text {\r\n position: relative !important;\r\n top: -10px !important; /* Adjust value as needed */\r\n}\r\n.ab-volume-saving-text {\r\n font-size: 1.30em !important;\r\n padding: 10px 10px !important; /* Increased height and width */\r\n min-width: fit-content !important;\r\n width: 100% !important; /* Adjust width responsively */\r\n max-width: 170% !important;\r\n box-sizing: border-box !important;\r\n text-align: center !important;\r\n margin: 0 auto !important; /* Center align for responsiveness */\r\n}\r\n\r\n.ab-volume-discount-original-price {\r\n margin-right: 155px; /* Pushes the element left */\r\n margin-top: -20px; /* Moves the element up */\r\n font-size: 1.3em !important; /* Adjusts the text size */\r\n color: #FF5733 !important; /* Sets text color (orange-red) */\r\n}\r\n\r\n.ab-volume-discount-price-container, \r\n.ab-volume-discount {\r\n width: 100% !important; /* Adjusts the container width */\r\n max-width: 400px !important; /* Limits maximum width */\r\n height: auto !important; /* Ensures it adapts to content */\r\n position: relative !important; \r\n top: -10px !important; /* Moves the elements up */\r\n}\r\n\r\n/* Adjusting Buy Button to widen only on the right */\r\n.buy-button {\r\n display: inline-block;\r\n padding-left: 10px; /* Keep the left padding fixed */\r\n padding-right: 90px; /* Increase right padding to widen the button */\r\n text-align: center;\r\n width: auto; /* Allow the button to adjust its width automatically */\r\n max-width: none; /* Disable maximum width */\r\n}\r\n\r\n.ab-volume-original-price {\r\n font-size: 1.6em !important; /* Adjust the size */\r\n color: #FF5733 !important; /* Set the color (orange-red) */\r\n}\r\n\r\n/* Color control for discount price container */ \r\n.ab-volume-discount {\r\n background-color: #99CCFF !important; /* Light blue background */\r\n border: 2px solid #99CCFF !important; /* Matching outer border color */\r\n position: relative; /* Ensures we can position the inner border correctly */\r\n}","customizeBundleOptionType":"RADIO","buyButtonSelector":null,"labels":"{\"productDiscountCombinedWithOrderDiscount\":true,\"bundleListViewDetailsButtonLabel\":\"View Details\",\"topBarFixedDiscountTitlePostfix\":\"{{currency}}{{discount}} off on shipping\",\"requiredLoginValidationLabel\":\"Please log in to purchase this bundle!\",\"volumeDiscountTypeLabel\":\"Volume Discount\",\"loginAlertLinkLabel\":\"Click here to login\",\"includedSubscriptionPlans\":\"\",\"breadCrumbProductsLabel\":\"Choose Products\",\"enableClassicBundleRecreation\":true,\"emptyProductImage\":\"https://cdn.shopify.com/s/files/1/0661/9224/4900/files/EmptyImage.jpg?v=1718447038\",\"enableAnnouncementBarAutoRotate\":true,\"reviewOrderInfoLabel\":\"\",\"productDiscountCombinedWithProductDiscount\":true,\"bundleMaximumQuantityLabel\":\"Add maximum up to {{maximum_quantity}} product\",\"volumeDiscountAppliesOnOneTimePurchase\":true,\"buyXGetYDiscountCodeText\":\"BUY_X_GET_Y_{{bundle_id}}\",\"productAddToBundleLabel\":\"Add\",\"breadCrumbReviewBundleLabel\":\"Review Bundle\",\"enableScrollingToBundleSection\":false,\"orderNoteLabel\":\"Order Note\",\"showProductPerPage\":50,\"requiresSubscriptionMessage\":\"Requires subscription\",\"dynamicBundleDiscountCombinedWithShippingDiscount\":true,\"hidePurchaseOptionSelectLabel\":false,\"showPriceAsDecimals\":false,\"fixedDiscountText\":\"Enjoy a fixed discount of {{currency}}{{discount_value}} on your purchase!\",\"sectionTotalLabel\":\"Section Total\",\"fieldDisabledBackgroundColor\":\"#D1D5DB\",\"bundleTotalLabel\":\"Total\",\"disableRefreshSellingPlan\":false,\"checkInventoryQuantity\":false,\"showSubscriptionPlanDescription\":false,\"disableProductDescription\":false,\"fixedPricingBundleTypeLabel\":\"Fixed Pricing Bundle\",\"subscriptionAvailableLabel\":\"Subscription Available\",\"excludeSubscriptionPlans\":\"\",\"readLessText\":\"Read Less\",\"buyXGetYDiscountAppliesOnSubscription\":true,\"shippingDiscountLabel\":\"{{discount}}{{discount_type}} Shipping Discount\",\"selectedGiftProductProgressLabelText\":\"{{selected_product_quantity}} gift products added, The required quantity is {{required_product_quantity}}\",\"disableFitImage\":false,\"secondaryTextColor\":\"#b99c59\",\"bundleProductsQuantityLabel\":\"{{quantity}}x quantity\",\"buyXGetYDiscountCombinedWithProductDiscount\":true,\"tieredDiscountLabel\":\"{{discount_amount}}{{discount_type}} Discount\",\"buyXGetYQuantityValidationLabel\":\"Add {{product_quantity}} quantities of the gift product (Get Y)\",\"primaryTextColor\":\"#000000\",\"modalOpenOnAddToCart\":true,\"notApplicableForSubscribeAndSaveNotificationTitle\":\"Not applicable for subscribe & save\",\"customSignInLink\":\"\",\"volumeDiscountChooseProductLabel\":\"Choose Product\",\"productDiscountAppliesOnOneTimePurchase\":true,\"topBarDiscountUnlockTitlePrefix\":\"You've unlocked \",\"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}}\",\"notAvailableSubscriptionMessage\":\"Not available for subscription\",\"primaryColor\":\"#071775\",\"buyXGetYGiftProductPriceVisibilityType\":\"UNIT_PRICE\",\"shippingDiscountRecurringCycleLimit\":0,\"volumeDiscountVariantSelectLabel\":\"Denominations\",\"chooseSourceProductValidationLabel\":\"Please choose source product!\",\"shippingDiscountAppliesOnSubscription\":true,\"headingTextColor\":\"#000000\",\"volumeDiscountSpentAmountRewardsLabel\":\"Spend {{currency}}{{spent_amount}} and get {{discount}}{{discount_type}} discount!\",\"hideBundleToastNotification\":false,\"classicBundleTypeLabel\":\"Classic Bundle\",\"oneTimeAvailableHintLabel\":\"One-time purchase available.\",\"volumeDiscountRecurringCycleLimit\":0,\"bundleListDescription\":\"Explore our Bundles and Discounted Pricing and enjoy exclusive discounts when you buy products together\",\"getYNoProductSelectedLabel\":\"No gift product selected (Get Y)\",\"prepaidPerDeliveryPriceLabel\":\"{{prepaid_per_delivery_price}}/delivery\",\"hideVariantSelectLabel\":false,\"availableOnlySubscriptionLabel\":\"Available Only On Subscription\",\"enableParentProductDetailButton\":false,\"bundleListTitle\":\"List of Bundles and Discounted Pricing\",\"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}}!\",\"bundlePageBackgroundColor\":\"#FAFAF9\",\"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\":\"BUY NOW\",\"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,\"productDiscountTypeLabel\":\"Product Discount\",\"bundleSearchBarPlaceholder\":\"Search product by name or title\",\"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,\"productCardBackgroundColor\":\"#ffffff\",\"buyXGetYFreeLabel\":\"Free\",\"buttonBackgroundColor\":\"#071775\",\"dockbarHeadingLabel\":\"Bundle\",\"discountMessageInterval\":3000,\"sectionedBundleTypeLabel\":\"Sectioned Bundle\",\"buyXGetYAddToCartLabel\":\"Add to cart\",\"volumeDiscountChooseButtonLabel\":\"Choose\",\"buyXGetYDiscountCombinedWithShippingDiscount\":true,\"dynamicBundleDiscountCodeText\":\"BUNDLE_DISCOUNT_{{bundle_id}}\",\"switchPurchaseModeLabel\":\"Switch\",\"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,\"showPrepaidPerDeliveryPrice\":true,\"enableProductDetailButton\":true,\"discountTargetType\":\"VARIANT\",\"buyXGetYDiscountTypeLabel\":\"Buy X Get Y Discount\",\"customOfferLink\":\"collections/all\",\"noItemsInBundle\":\"No items added to the bundle\",\"topBarPercentDiscountTitlePostfix\":\"{{discount}}% off on shipping\",\"variantSelectionDropDownLabel\":\"Variants\",\"chooseSectionLabel\":\"Choose Section\",\"dynamicPricingBundleTypeLabel\":\"Dynamic Pricing Bundle\",\"breadCrumbPlanLabel\":\"Select Plan\",\"showDynamicBundleOrderNote\":false,\"showOutOfStockProduct\":true,\"disabledSellingPlanSelectionValidation\":false,\"disableViewShopifyProduct\":false,\"bundleDiscountLabel\":\"Discount\",\"topBarDiscountRequiredAmountTitlePrefix\":\"Add {{currency}}{{remainingAmount}} more to unlock \",\"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\":\"SAVE\",\"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\",\"enableAnnouncementBar\":false,\"bundleQuantityLabel\":\"{{quantity}}x\",\"showClassicBundleWidgetInChildProduct\":false,\"shippingDiscountAppliesOnOneTimePurchase\":true,\"classicBundleLinkLabel\":\"Go to the Classic Bundle\",\"topBarDiscountRequiredQuantityTitlePrefix\":\"Add {{remainingQuantity}} more item(s) to unlock \",\"bundleDetailsLabel\":\"Your bundle:\",\"buyXGetYDiscountAppliesOnOneTimePurchase\":true,\"volumeDiscountAppliedSpentAmountRewardsLabel\":\"Applied: spend {{spent_amount}}{{currency}} get {{discount}}{{discount_type}}\",\"enableAutoRemoveRelevantBundleItemInCart\":false,\"bundleModalShowRewardsLabel\":\"Show all rewards\",\"topBarFreeShippingTitlePostfix\":\"free shipping\",\"buyXGetYDiscountRecurringCycleLimit\":0,\"cartAndCheckoutMandatoryProductValidationMessage\":\"This bundle or discount must include all required products and they cannot be removed.\",\"enableSequentialProductLoading\":false,\"volumeAmountDiscountSpentAmountRewardsLabel\":\"Spend {{currency}}{{spent_amount}} and get {{currency}}{{discount}} discount!\",\"notApplicableForOneTimeNotificationTitle\":\"Not applicable for one time\",\"showDiscountToNonEligibleCustomers\":false,\"primaryDisabledTextColor\":\"#99CCFF\",\"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\",\"subscriptionAvailableHintLabel\":\"Subscribe & save available.\",\"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\":\"[]\",\"sectionedBundleDiscountCodeText\":\"SECTIONED_DISCOUNT_{{bundle_id}}\",\"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,"tieredDiscountQuantityLabel":null,"tieredDiscountAmountLabel":null,"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,"showMainToggleForProductLevel":null,"hideProductPurchaseModeAwarenessHint":null,"hideIncompatibleProductMessage":null,"subscriptionAvailableHintLabel":"Subscribe & save available.","oneTimeAvailableHintLabel":"One-time purchase available.","switchPurchaseModeLabel":"Switch","notAvailableSubscriptionMessage":"Not available for subscription","requiresSubscriptionMessage":"Requires subscription","primaryColor":"#071775","primaryTextColor":"#000000","secondaryTextColor":"#b99c59","primaryHoverColor":"#000000","primaryDisabledColor":"#333333","primaryDisabledTextColor":"#99CCFF","fieldDisabledBackgroundColor":"#D1D5DB","disabledTextColor":"#6B7280","volumeDiscountSaveRewardsLabel":"BUY NOW","volumeDiscountQuantityRewardsLabel":"SAVE","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":true,"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":false,"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","childProductInfoBannerText":null,"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,"enableClassicBundleRecreation":true,"topBarDiscountUnlockTitlePrefix":"You've unlocked ","topBarDiscountRequiredAmountTitlePrefix":"Add {{currency}}{{remainingAmount}} more to unlock ","topBarDiscountRequiredQuantityTitlePrefix":"Add {{remainingQuantity}} more item(s) to unlock ","topBarPercentDiscountTitlePostfix":"{{discount}}% off on shipping","topBarFixedDiscountTitlePostfix":"{{currency}}{{discount}} off on shipping","topBarFreeShippingTitlePostfix":"free shipping","checkInventoryQuantity":false,"hideBundleToastNotification":false,"enableBundleRecreation":null,"enableAnnouncementBar":false,"enableAnnouncementBarAutoRotate":true,"bundleListTitle":"List of Bundles and Discounted Pricing","bundleListDescription":"Explore our Bundles and Discounted Pricing and enjoy exclusive discounts when you buy products together","bundleListViewDetailsButtonLabel":"View Details","classicBundleTypeLabel":"Classic Bundle","dynamicPricingBundleTypeLabel":"Dynamic Pricing Bundle","fixedPricingBundleTypeLabel":"Fixed Pricing Bundle","sectionedBundleTypeLabel":"Sectioned Bundle","volumeDiscountTypeLabel":"Volume Discount","productDiscountTypeLabel":"Product Discount","buyXGetYDiscountTypeLabel":"Buy X Get Y Discount","bundlePageBackgroundColor":"#FAFAF9","productCardBackgroundColor":"#ffffff","buttonBackgroundColor":"#071775","showPrepaidPerDeliveryPrice":true,"prepaidPerDeliveryPriceLabel":"{{prepaid_per_delivery_price}}/delivery","bundleSearchBarPlaceholder":"Search product by name or title","headingTextColor":"#000000","volumeDiscountChooseButtonLabel":"Choose","volumeDiscountChooseProductLabel":"Choose Product","sectionedBundleDiscountCodeText":"SECTIONED_DISCOUNT_{{bundle_id}}","buyXGetYDiscountCodeText":"BUY_X_GET_Y_{{bundle_id}}","volumeDiscountBuyXGetYFreeRewardsCodeText":null,"volumeDiscountFreeGiftDiscountCodeText":null};
const isLoggedIn = false
const customerTags = null
for (const element of discountElements) {
const variantId = parseInt(element.getAttribute('data-variant-id'), 10);
const matchedBundleRules = getMatchingBundleRulesByVariantId(variantId, isLoggedIn, customerTags);
const allTieredDiscounts = getAllTieredDiscountsByMatchedVolumeBundles(matchedBundleRules);
const currentAppliedDiscount = getCurrentTieredDiscountByVariantId(cartItems, allTieredDiscounts, variantId, false);
const nextApplicableDiscount = getCurrentTieredDiscountByVariantId(cartItems, allTieredDiscounts, variantId, true);
if (!areObjectsIdentical(currentAppliedDiscount, nextApplicableDiscount) && nextApplicableDiscount) {
const cartItem = getMatchedCartItemByVariantId(cartItems, variantId);
const nextApplicableDiscountLabel = `${nextApplicableDiscount.discountBasedOn === 'QUANTITY' ? 'Buy' : `Spend ${window?.Shopify?.currency?.active}`} ${nextApplicableDiscount.value} get ${nextApplicableDiscount.discountType === 'FIXED_AMOUNT' ? `${window?.Shopify?.currency?.active} ` : ''}${nextApplicableDiscount.discount}${nextApplicableDiscount.discountType === 'PERCENTAGE' ? '%' : ''}`;
const updatedNextApplicableDiscountLabel = nextApplicableDiscount?.discountBasedOn === "QUANTITY" && bundleSettings?.volumeDiscountNextApplicableQuantityRewardsLabel ? bundleSettings?.volumeDiscountNextApplicableQuantityRewardsLabel.replace("{{quantity}}", nextApplicableDiscount?.value).replace("{{discount}}", nextApplicableDiscount?.discount).replace("{{discount_type}}", nextApplicableDiscount?.discountType === "PERCENTAGE" ? "%" : ` ${window?.Shopify?.currency?.active}`) :
nextApplicableDiscount?.discountBasedOn === "AMOUNT" && bundleSettings?.volumeDiscountNextApplicableSpentAmountRewardsLabel ? bundleSettings?.volumeDiscountNextApplicableSpentAmountRewardsLabel.replace("{{spent_amount}}", nextApplicableDiscount?.value).replace("{{currency}}", ` ${window?.Shopify?.currency?.active}`).replace("{{discount}}", nextApplicableDiscount?.discount).replace("{{discount_type}}", nextApplicableDiscount?.discountType === "PERCENTAGE" ? "%" : ` ${window?.Shopify?.currency?.active}`) : nextApplicableDiscountLabel;
element.innerHTML = createDiscountLink(updatedNextApplicableDiscountLabel, cartItem?.url);
} else {
element.innerHTML = '';
}
}
};
const setupCartMutationObserver = () => {
const targetNode = document.body;
if (!targetNode) return;
const observer = new MutationObserver(async mutations => {
const cartChanged = mutations.some(mutation =>
mutation.type === 'childList' || mutation.type === 'attributes'
);
if (cartChanged) {
observer.disconnect();
await executeCartLogic();
setupCartMutationObserver();
}
});
observer.observe(targetNode, { attributes: true, childList: true, subtree: true });
};
const areObjectsIdentical = (obj1, obj2) => {
if (typeof obj1 !== 'object' || typeof obj2 !== 'object' || obj1 === null || obj2 === null) {
return false;
}
const keys1 = Object.keys(obj1);
const keys2 = Object.keys(obj2);
if (keys1.length !== keys2.length) {
return false;
}
for (let key of keys1) {
if (!keys2.includes(key)) {
return false;
}
const val1 = obj1[key];
const val2 = obj2[key];
const areObjects = typeof val1 === 'object' && typeof val2 === 'object';
if (areObjects && !areObjectsIdentical(val1, val2)) {
return false;
} else if (!areObjects && val1 !== val2) {
return false;
}
}
return true;
};
const createDiscountLink = (content, url) => {
return `${content}`;
};
const getCurrentTieredDiscountByVariantId = (cartItems, allTieredDiscounts, variantId, isNextApplicableDiscount) => {
let applicableDiscount = null;
const cartItem = getMatchedCartItemByVariantId(cartItems, variantId);
if (!cartItem) return null;
if (cartItem && isNextApplicableDiscount) {
cartItem.quantity = cartItem.quantity + 1;
}
const originalPrice = ((cartItem.price * cartItem.quantity) / 100);
let applicableQuantityBasedDiscount = allTieredDiscounts
.filter(tieredDiscount => tieredDiscount.discountBasedOn === 'QUANTITY')
.filter(tieredDiscount => cartItem.quantity >= tieredDiscount.value);
applicableQuantityBasedDiscount = applicableQuantityBasedDiscount.length > 0 ? getBestQuantityOrAmountBasedDiscount(applicableQuantityBasedDiscount, originalPrice) : null;
let applicableSpendAmountBasedDiscount = allTieredDiscounts
.filter(tieredDiscount => tieredDiscount.discountBasedOn === 'AMOUNT')
.filter(tieredDiscount => originalPrice >= tieredDiscount.value);
applicableSpendAmountBasedDiscount = applicableSpendAmountBasedDiscount.length > 0 ? getBestQuantityOrAmountBasedDiscount(applicableSpendAmountBasedDiscount, originalPrice) : 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) * originalPrice) > applicableSpendAmountBasedDiscount.discount) {
applicableDiscount = applicableQuantityBasedDiscount;
} else {
applicableDiscount = applicableSpendAmountBasedDiscount;
}
} else if (applicableQuantityBasedDiscount.discountType === 'FIXED_AMOUNT' && applicableSpendAmountBasedDiscount.discountType === 'PERCENTAGE') {
if (applicableQuantityBasedDiscount.discount > ((applicableSpendAmountBasedDiscount.discount / 100) * originalPrice)) {
applicableDiscount = applicableQuantityBasedDiscount;
} else {
applicableDiscount = applicableSpendAmountBasedDiscount;
}
}
} else if (applicableQuantityBasedDiscount) {
applicableDiscount = applicableQuantityBasedDiscount;
} else if (applicableSpendAmountBasedDiscount) {
applicableDiscount = applicableSpendAmountBasedDiscount;
}
return applicableDiscount;
};
const getBestQuantityOrAmountBasedDiscount = (applicableQuantityOrAmountBasedDiscount, originalPrice) => {
return applicableQuantityOrAmountBasedDiscount.reduce((greater, current) => {
if ((greater.discountType === 'PERCENTAGE' && current.discountType === 'PERCENTAGE') || (greater.discountType === 'FIXED_AMOUNT' && current.discountType === 'FIXED_AMOUNT')) {
return current.discount > greater.discount ? current : greater;
} else if (current.discountType === 'FIXED_AMOUNT' && greater.discountType === 'PERCENTAGE') {
return current.discount > ((greater.discount / 100) * originalPrice) ? current : greater;
} else if (current.discountType === 'PERCENTAGE' && greater.discountType === 'FIXED_AMOUNT') {
return ((current.discount / 100) * originalPrice) > greater.discount ? current : greater;
}
return current.discount > greater.discount ? current : greater;
});
};
const getAllTieredDiscountsByMatchedVolumeBundles = (volumeBundles) => {
return volumeBundles.reduce((acc, item) => {
const tieredDiscount = JSON.parse(item?.tieredDiscount || '[]');
acc.push(...tieredDiscount);
return acc;
}, []);
};
const isBundleRestrictedCustomerByTagsByNextVolumeDiscount = (item, customerTags) => {
if (!item?.restrictTags) return false;
const restrictTags = item?.restrictTags?.split(',');
return (
customerTags && customerTags?.length > 0 && customerTags?.some(tag => restrictTags?.includes(tag))
);
};
const isBundleAllowedByCustomersTagByNextVolumeDiscount = (item, customerTags) => {
if (!item?.allowedTags) return true;
const allowedCustomersOnly = item?.allowedTags?.split(',');
return (
customerTags &&
customerTags?.length > 0 &&
customerTags?.some(tags => allowedCustomersOnly?.includes(tags))
);
};
const isBundleRestrictedByNextVolumeDiscount = (item, customerTags) => {
return isBundleRestrictedCustomerByTagsByNextVolumeDiscount(item, customerTags) || !isBundleAllowedByCustomersTagByNextVolumeDiscount(item, customerTags);
};
const getMatchingBundleRulesByVariantId = (variantId, isLoggedIn, customerTags) => {
const bundleRules = [{"id":12013,"shop":"norrgear.myshopify.com","name":"12-Packs FREE DELIVERY 20% DISCOUNT","description":"","status":"ACTIVE","customerIncludeTags":null,"discountType":"NO_DISCOUNT","discountValue":null,"products":"null","variants":"[{\"productId\":14922466754935,\"variantId\":54994986566007,\"name\":\"6000mg CBD | 120 PATCHES | 120 X 50mg CBD 0mg THC | FREE DELIVERY \",\"productHandle\":\"6000mg-cbd-120-patches-120-x-50mg-cbd-0mg-thc-free-delivery\",\"imageSrc\":\"https://cdn.shopify.com/s/files/1/0251/1559/0710/files/6000mg_CBD_120_PATCHES_120_X_50mg_CBD_0mg_THC_FREE_DELIVERY_BUY_ONLINE_O-HITS_1_ONLINE_CBD_STORE.png?v=1741528629\",\"quantity\":1,\"price\":\"384.00\",\"status\":\"ACTIVE\",\"productTitle\":\"6000mg CBD | 120 PATCHES | 120 X 50mg CBD 0mg THC | FREE DELIVERY\",\"variantTitle\":null,\"isMandatory\":false,\"preSelected\":false,\"minQuantity\":null,\"maxQuantity\":null}]","sequenceNo":null,"bundleType":"VOLUME_DISCOUNT","settings":"{\"showUnitPrice\":false,\"showPricesWithoutDecimal\":false,\"showPriceWithSubscriptionPrice\":true,\"showPriceOfChosenProductsOnly\":false}","bundleProductId":null,"bundleVariantId":null,"productHandle":null,"discountId":null,"price":null,"numberOfProducts":0,"subscriptionBundlingEnabled":false,"subscriptionId":null,"minProductCount":null,"maxProductCount":null,"uniqueRef":"D9CqE5ZP5V","bundleRedirect":"CART","customRedirectURL":null,"minOrderAmount":null,"tieredDiscount":"[{\"discountBasedOn\":\"QUANTITY\",\"value\":12,\"discount\":20.0,\"discountType\":\"PERCENTAGE\",\"discountAllowedTags\":null,\"titleLabel\":\"SAVE\"}]","productViewStyle":"QUICK_ADD","singleProductSettings":"null","trackInventory":false,"sellingPlanType":"BUNDLE_LEVEL","clearCart":"ENABLED","minPrice":null,"maxPrice":null,"externalBuildABoxId":null,"variantVisibilityType":"SHOW_VARIANTS_AS_OPTIONS","subTitle":null,"freeShipping":false,"themeType":"THEME_ONE","showBundleInProductPage":true,"combinedWithProductDiscount":true,"combinedWithShippingDiscount":true,"combinedWithOrderDiscount":true,"allowedTags":null,"restrictTags":null,"selectionType":"FLEXIBLE","bundleHtml":"null","discountedVariants":"null","allowedCountries":null,"appliesOn":"ONE_TIME","purchaseRequirement":"NO_REQUIREMENT","productDiscountType":"EACH_PRODUCT","countrySelectionType":"ALL_COUNTRY","discountApplyApproach":"SHOPIFY_DISCOUNT_FUNCTION","discountedProductChooseType":"CHOOSE_ALL","internalName":"12-Packs OFFER 15mg PATCHES","sections":"[{\"id\":1,\"name\":\"\",\"description\":\"\",\"minProductCount\":0,\"maxProductCount\":0,\"variants\":[]}]","limitToUsePerCustomer":null,"discountedVariantSelectionLimit":null,"hideOneTimePurchase":false,"hideSubscriptionPurchase":false,"maxOrderAmount":null,"collectionData":null,"productSelectionType":"PRODUCT","tag":"appstle_bundles","productChooseType":null,"variantSelectionLimit":null,"discountTargetType":"VARIANT","enableSubscription":null,"subscriptionWidgetPosition":null,"subscribeTitle":null,"subscribeSubtitle":null,"subscriptionPreselected":null,"getYAppliesOn":null,"announcementBarMessage":null,"automaticDiscountNodeId":"gid://shopify/DiscountAutomaticNode/2241920893303","recurringCycleLimit":0,"automaticShippingDiscountNodeId":null,"scheduledBundleRule":null,"bundleActiveFrom":null,"bundleActiveTo":null,"bundleSubType":null,"discountAppliesOn":"PER_LINE_ITEM","layoutType":null,"style":"{\"productCardBackgroundColor\":\"#ffffff\",\"disabledTextColor\":\"#6B7280\",\"buttonBackgroundColor\":\"#071775\",\"bundlePageBackgroundColor\":\"#FAFAF9\",\"headingTextColor\":\"#000000\",\"primaryHoverColor\":\"#000000\",\"primaryTextColor\":\"#000000\",\"primaryColor\":\"#071775\",\"primaryDisabledColor\":\"#333333\",\"primaryDisabledTextColor\":\"#99CCFF\",\"secondaryTextColor\":\"#b99c59\",\"fieldDisabledBackgroundColor\":\"#D1D5DB\"}","labels":"{}","upsells":null,"enableVolumeDiscountUpsell":false,"combos":null}];
return bundleRules?.filter(rule => {
if ((rule?.allowedTags || rule?.restrictTags) && !isLoggedIn) {
return false;
}
if ((rule?.allowedTags || rule?.restrictTags) && isLoggedIn && isBundleRestrictedByNextVolumeDiscount(rule, customerTags)) {
return false;
}
return rule?.bundleType === 'VOLUME_DISCOUNT' && rule?.status === 'ACTIVE' && JSON.parse(rule?.variants)?.some(variant => parseInt(variant?.variantId, 10) === variantId);
}) || [];
};
const getMatchedCartItemByVariantId = (cartItems, variantId) => cartItems?.items?.find(item => item?.variant_id === variantId);
const getShopifyCartItems = async () => {
try {
const response = await fetch(`${Shopify?.routes?.root}cart.js`);
if (!response.ok) {
console.error('Network response was not ok');
return [];
}
return await response.json();
} catch (error) {
console.error('Failed to fetch cart items:', error);
return [];
}
};
})();