PageSourceSearch

https://hillbergandberk.com/cdn/shop/t/709/assets/section-gwp.js?v=178204654480730808731790022069

js hillbergandberk.com collected 2026-09-24 18:30:55 UTC 5,348 bytes, 2 lines download raw bytes

1var cartTotal=0,gwpQualificationProduct=!1,gwpQualificationProductQuantity=0,giftProductQuantity=0,gwpPresent=!1,gwpQualified=!1;const defaultCurrency="CAD",selectedCurrency=$(".currency-picker__label:first").text(),gwpContainer=".gwp-container";var gwpThreshold=150;function openGwp(){if(gwpQualified==!0&&!gwpPresent){data=[];var bundle=$(this).data("block");bundleName="Gift with Purchase";var feed={id:gwpId,quantity:1,properties:{Promo:bundleName}};data.push(feed),window.themeCore.CartApi.makeRequest(themeCore.CartApi.actions.ADD_TO_CART_MANY,data).then(res=>{window.themeCore.CartApi.makeRequest(window.themeCore.CartApi.actions.UPDATE_CART)})}}function getCart(){setTimeout(function(){jQuery.ajax({type:"GET",url:"/cart.js",dataType:"json",success:function(cart){if(cartTotal=0,$.each(cart.items,function(i,f){var handle=f.handle;console.log(f),$.each(f.properties,function(i2,property){var str=property.toLowerCase();i2.indexOf("Promo")>-1&&(gwpPresent=!0,giftId=f.key)}),handle.indexOf("gift-card")==-1&&(cartTotal+=f.line_price),f.handle==giftProduct&&gwpQualificationType=="collection"&&(gwpPresent=!0),gwpQualificationType=="collection"&&f.handle==giftProduct&&(giftProductQuantity+=f.quantity),$.inArray(handle,qualificationProducts)!==-1&&gwpQualificationType=="collection"&&(gwpQualificationProduct=!0,gwpQualificationProductQuantity+=f.quantity)}),cartTotal=cartTotal/100,gwpQualificationType=="collection")switch(cartTotal!==0&&!gwpPresent&&$(".gwp-reminder").fadeIn(),$(".gwp-qualified").hide(),$(".gwp-unqualified").hide(),$(".gwp-missing-item").hide(),!0){default:$(".gwp-reminder").fadeIn();break;case(gwpQualificationProductQuantity>0&&cartTotal>gwpThreshold):$(".gwp-qualified").show(),gwpQualified=!0;break;case cartTotal<gwpThreshold:$(".gwp-unqualified").show(),gwpQualified=!1;break;case(gwpQualificationProductQuantity<=0&&cartTotal>gwpThreshold):$(".gwp-missing-item").show(),gwpQualified=!1;break;case giftProductQuantity>0:$(".gwp-reminder").fadeOut();break}else cartTotal!==0&&!gwpPresent?($(".gwp-remainder").text(currencySymbol+Math.round(gwpThreshold-cartTotal)),cartTotal<gwpThreshold&&$(".gwp-reminder").fadeIn(),cartTotal<gwpThreshold||gwpQualificationType=="product"?($(".gwp-qualified").hide(),$(".gwp-unqualified").show(),$(".gwp-missing-item").hide(),gwpQualified=!1):($(".gwp-reminder").fadeOut(),$(".gwp-qualified").show(),$(".gwp-unqualified").hide(),$(".gwp-missing-item").hide(),gwpQualified=!0)):($(".gwp-reminder").fadeOut(),cartTotal==0&&(gwpQualified=!1));openGwp(cartTotal),gwpPresent&&cartTotal<gwpThreshold&&gwpQualificationType=="cart_total"&&jQuery.ajax({type:"POST",url:"/cart/change.js",data:"quantity=0&id="+giftId,dataType:"json",success:function(cart2){window.themeCore.CartApi.makeRequest(window.themeCore.CartApi.actions.UPDATE_CART),window.themeCore.CartApi.makeRequest(window.themeCore.CartApi.actions.GET_CART),gwpPresent=!1,getCart()},error:function(XMLHttpRequest,textStatus){Shopify.onError(XMLHttpRequest,textStatus)}}),$(".gwp-progress").width((cartTotal/gwpThreshold*100).toFixed(2)+"%"),$(".gwp-remaining").text(currencySymbol+(gwpThreshold-cartTotal)),$(".gwp-qualification").text(currencySymbol+gwpThreshold)}.bind(this),error:function(XMLHttpRequest,textStatus){Shopify.onError(XMLHttpRequest,textStatus)}})},2e3)}$(window).on("load",function(){discountedPrice=currencySymbol+giftPrice1*100/100,$(".discounted-price-1").html(discountedPrice),discountedPrice=currencySymbol+giftPrice2*100/100,$(".discounted-price-2").html(discountedPrice),getCart()}),$(document).on("mouseup",".add-to-cart",function(){getCart()}),$(document).on("click",gwpContainer+" .modal__close, .gwp-background",function(){var today=new Date,expire=new Date;expire.setTime(today.getTime()+36e5*24*14),document.cookie="gwp-h-b-tote-bag=1; path=/; expires="+expire.toGMTString(),$(gwpContainer).fadeOut("fast"),$("body").removeClass("modal-open")}),$(document).on("click",".gwp-add",function(e){window.themeCore.CartApi.makeRequest(themeCore.CartApi.actions.ADD_TO_CART,{id:$(this).siblings(".gift_id").val(),quantity:1,properties:{Promo:giftPropertyValue}}).then(res=>{$(gwpContainer).fadeOut("fast"),$("body").removeClass("modal-open"),setTimeout(function(){window.loyaltylion&&window.loyaltylion.ui.refresh()},1e3)}).catch(e2=>{console.log(JSON.stringify(e2)),console.log($(this).siblings(".gift_id").val())}),e.preventDefault()}),$(document).on("click",".js-cart-item-remove, .header__icon--cart, .quantity",function(){gwpPresent=!1,gwpQualificationProductQuantity=0,getCart()}),$(document).on("click",gwpContainer+" .variant-input",function(){$(this).parents(".gift-product").find(".gift-image").attr("src",$(this).find("input").data("image")),$(this).parents(".gift-product").find(".gift_id").val($(this).find("input").val()),$(gwpContainer).find(gwpContainer+" .variant-input input").attr("checked",!1),$(this).find("input").attr("checked",!0),gwpDiscountType=="percent"&&(variantPrice=$(this).find("input").data("price"),discountedPrice=Math.round(Currency.convert(variantPrice,defaultCurrency,selectedCurrency)*100)/100,discountedPrice=discountedPrice*gwpPercentPrice/100,$(".product__price del").html(currencySymbol+variantPrice),$(".discounted-price").html(currencySymbol+discountedPrice))});
2//# sourceMappingURL=/cdn/shop/t/709/assets/section-gwp.js.map?v=178204654480730808731790022069

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.