');
quickShopImage.append('');
var qs_images = selectedProduct.images;
$.each(qs_images, function(index, value) {
if(index)
quickShopImage.find('.qs-vertical-slider').append('');
else
quickShopImage.find('.qs-vertical-slider').append('');
});
theme.thumbGallerySlider();
$('#quick-shop-image').on('click', '.image-thumb', function() {
var $this = $(this);
var background = $('.product-image .main-image .main-image-bg');
var parent = $this.parents('.product-image-wrapper');
var src_original = $this.attr('data-image-zoom');
var src_display = $this.attr('data-image');
background.show();
parent.find('.image-thumb').removeClass('active');
$this.addClass('active');
parent.find('.main-image').find('img').attr('data-zoom-image', src_original);
parent.find('.main-image').find('img').attr('src', src_display).load(function() {
background.hide();
});
return false;
});
// Update title
quickShopTitle.html('' + selectedProduct.title + '');
// Update Rating Review
quickShopRating.html('');
// Update description
quickShopDescription.html(selectedProduct.description.substring(0,300)+"...");
// Generate variants
var productVariants = selectedProduct.variants;
var productVariantsCount = productVariants.length;
quickShopPriceContainer.html('');
quickShopVariantsContainer.html('');
quickShopAddToCartButton.removeAttr('disabled').fadeTo(200,1);
if (productVariantsCount > 1) {
// Reveal variants container
quickShopVariantsContainer.show();
// Build variants element
var quickShopVariantElement = $('"
}
if (typeof prod.image == "object" && prod.image && typeof prod.image.src == "string") {
var n = prod.image.src.lastIndexOf(".");
if (n >= 0){
var s = prod.image.src.substring(0, n) + "_medium." + prod.image.src.substring(n + 1);
prod.image.src = s
}
}
enhancedProducts.push(prod)
}
//Build an array with request to products
ba_data.items.map(function(p){
arr.push($.getJSON("/products/" + p.handle + ".json",function(data){ enhanceProduct(data,p) }).fail(function(jqXHR, textStatus, errorThrown){
postNotFoundError(p.handle)
})
)
});
if (arr.length == 0) { return }
$.when.apply($, arr).done(function() {
products = enhancedProducts;
if (products.length == 0) return false;
var noVariants = true;
for (var i = 0; i 1) {
noVariants = false
}
}
if (noVariants){
for (var i = 0; i maxHeight) { maxHeight = $(bn).height(); }
});
$(bundle).find("div.bundle-name").height(maxHeight);
var matchWidth = true;
try {
matchWidth = eval('window.matchMedia("(min-width: 650px)").matches');
}
catch(ex){
var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
matchWidth = width >= 650;
}
if (matchWidth && $(bundle).find('.ba-eqs:visible').length > 0) {
var imageContainerHeight = $(bundle).find("div.ba-image-container").height();
var bundleTotal = $(bundle).find("div.bundle-total");
var bundleMargin = ((imageContainerHeight - bundleTotal.height()) / 2).toFixed(1);
bundleTotal.attr('style', "margin-top:" + bundleMargin + "px;margin-bottom:" + bundleMargin + "px;");
}
var setCurrentVariant = function(newVariantId) {
if (!newVariantId) return;
window.booster.currentVariantId = newVariantId;
var optionSelector = "select.ba-variants[data-product-handle='" + window.booster.currentHandle + "']"
//Try to assign new value only if option present
if ($(optionSelector +" option[value='" + newVariantId + "']").length > 0) { $(optionSelector).val(newVariantId).trigger('change') }
}
setCurrentVariant(window.booster.currentVariantId);
actOnVariantChange(setCurrentVariant);
productPageTestOfferSeen();
registerEvent('offer_view',{app_type: 'bundle',offer_id: ba_data.offerId})
reloadCurrency();
})
}
function getResources(url,resource_name,max_quantity,collection,page,callback)
{
//stop extraction if we reached max_quantity
if (collection.length >= max_quantity) {
//adjust collection if too many objects extracted
collection.splice(0, (collection.length - max_quantity));
callback();
return;
}
$.getJSON(url + ".json?page=" + page, function(data) {
//if response include some resources
if (data[resource_name] && data[resource_name].length > 0)
{
collection.push.apply(collection,data[resource_name])
//get more items from the next page
getResources(url,resource_name, max_quantity, collection, page + 1,callback);
}
else //no more resources present
{
collection.splice(0, (collection.length - max_quantity));
callback();
}
})
}
function addCollectionUpsells(upsell_collection_arr,data,callback) {
var products = [];
var upsell_items = [];
var collection = upsell_collection_arr.collection[0]
//Todo: loop over collection to get products from different collections?
getResources("collections/" + collection.handle + "/products", 'products', 20, products, 1, function () {
products.forEach(function (product) {
//generate upsell items
upsell_items.push({product: product,
handle: product.handle,
id: product.id,
discount_applies: upsell_collection_arr.discount_applies,
discount_method: upsell_collection_arr.discount_method,
offer_id: upsell_collection_arr.offer_id,
qty_left: upsell_collection_arr.qty_left,
upsell_note: upsell_collection_arr.upsell_note,
value: upsell_collection_arr.value})})
//initialize upsell_array if necessary
if (!data.discounts.upsell_arr) data.discounts.upsell_arr = [];
//collect existing upsell product ids.
var existing_product_ids = data.discounts.upsell_arr.map(function (item) { return item.id });
//add upsell items if they not present in the upsell_array yet
upsell_items.forEach(function (item) {
var product_position = existing_product_ids.indexOf(item.id)
//Add or replace item to avoid additional requests to products.
if (product_position > -1) {
data.discounts.upsell_arr[product_position] = item;
} else {
data.discounts.upsell_arr.push(item);
}
})
callback();
})
}
function upsellDisplayPrice(discount_method,price,compare_at_price) {
return (discount_method=='no_discount' && compare_at_price && compare_at_price != "") ? baDisplayCents(compare_at_price) : price;
}
function cssLengthWord(value) {
switch (value) {
case 1:
return 'one'
break;
case 2:
return 'two'
break;
case 3:
return 'three'
break;
case 4:
return 'four'
break;
default:
return 'two'
}
}
function generateUpsellProduct(data,offerId,upsellNote,discount_applies,discount_method,discount_value)
{
var prod = data.product;
prod.offer_id = offerId;
prod.upsell_note = upsellNote;
prod.discount_applies = discount_applies;
prod.variantsStyle = "";
prod.variantsSelect = "";
//Remove out of stock variants
prod.variants = prod.variants.filter(function(v){ return window.booster.productsInStock[prod.id].variants_stock[v.id].available =='true' })
for (var i = 0; i prod.variants[i].price) {
prod.variants[i].compare_at_price = prod.variants[i].compare_at_price
} else {
prod.variants[i].compare_at_price = ""
}
prod.variants[i].price = baDiscountedPrice(prod.variants[i].price, discount_applies, discount_method, discount_value);
}
//Try to create product image property if it's missing.
if (typeof prod.image != "object" && typeof prod.images == "object") {prod.image = prod.images[0];}
if (prod.variants.length == 1) {
prod.variantsStyle = "display: none;";
} else {
var variantsHtml = "";
prod.variants.map(function (variant) {
if (typeof variant.inventory_management == "string" && variant.inventory_management == "shopify") {
if (typeof variant.inventory_policy == "string" && variant.inventory_policy == "deny" && typeof variant.inventory_quantity == "number" && variant.inventory_quantity = 0) {
var s = baImg.substring(0, n) + "_medium." + baImg.substring(n + 1);
baImg = s
}
variantsHtml += ""
});
prod.variantsSelect = ""
}
if (typeof prod.image == "object" && prod.image && typeof prod.image.src == "string") {
var n = prod.image.src.lastIndexOf(".");
if (n >= 0) {
var s = prod.image.src.substring(0, n) + "_medium." + prod.image.src.substring(n + 1);
prod.image.src = s
}
}
prod.link = "/products/" + prod.handle ;
prod.linkClass = '' ;
return prod;
}
var currentFunnel = null;
var mainFunnel = null;
var firstFunnel = true;
var funnelRefusedTimes = 0;
var funnelRefusedLimit = 1;
var funnelProductAdded = false;
var upsellItemAdded = false;
var allFunnelProducts = null;
function showBaUpsell(ba_data){
var upsell_items = (ba_data.discounts["upsell_items"] || {})
var replaceTriggers = upsell_items["replace_trigger"] || false
var replaceItems = upsell_items["items"] || []
var replaceVariants = replaceItems.map(function(i){ return i["variant_id"] }) || []
var arr = [];
var products = [];
var upsellItem = ba_data.discounts.upsell_arr[0];
var offerId = upsellItem.offer_id;
var upsellNote = upsellItem.upsell_note;
var discount_applies = upsellItem.discount_applies;
var discount_method = upsellItem.discount_method;
var discount_value = upsellItem.value;
if (ba_data.discounts.funnel && ba_data.discounts.funnel[1]) {
currentFunnel = ba_data.discounts.funnel[1];
mainFunnel = ba_data.discounts.funnel;
}
//Limit amount of products according to shop settings
ba_data.discounts.upsell_arr.splice(0,ba_data.discounts.upsell_arr.length - 20 )
//populate arr with async actions
ba_data.discounts.upsell_arr.map(function(p){
if (p.product){
arr.push(new Promise(function(resolve, reject) {
products.push(generateUpsellProduct({product: p.product},offerId,upsellNote,discount_applies,discount_method,discount_value))
resolve(true);
}));
}
else {
arr.push($.getJSON("/products/" + p.handle + ".json", function(data){
products.push(generateUpsellProduct(data,offerId,upsellNote,discount_applies,discount_method,discount_value ));
}).fail(function(jqXHR, textStatus, errorThrown){
postNotFoundError(p.handle);
}))
}
});
if (arr.length == 0) {
return
}
$.when.apply($, arr).done(function() {
if (products.length == 0) {
return
}
var noVariants = true;
for (var i = 0; i 1) {
noVariants = false
}
products[i].quantity = 1;
var curProd = ba_data.discounts.upsell_arr.filter(function(p) {
return p.id == products[i].id
});
if (curProd.length == 1 && curProd[0].qty > 1) {
products[i].quantity = curProd[0].qty
}
if (curProd.length == 1 && curProd[0].qty_left) {
products[i].qty_left = curProd[0].qty_left
}
}
if (noVariants){
for (var i = 0; i 1;
var context = {
multiple_products: multiple_products.toString(),
discount_applies: discount_applies.toString(),
upsell_note: upsellNote,
products: products,
css_length: cssLength,
ba_plus_url: baPlusImageUrl,
offer_id: offerId,
discount_method: discount_method,
discount_value: discount_value,
replace_trigger: replaceTriggers,
replaceVariants: (replaceVariants || []).join(',')
};
var template = baHandlebars.compile(source);
var html = template(context);
$('body').append(html.replace(/undefined/g, ' '));
//Old way
$('#dpModal-container').dpModal();
registerBuyxTestOfferSeen();
registerEvent('offer_view',{app_type: 'buyx',offer_id: offerId});
reloadCurrency();
});
}
function registerBuyxTestOfferSeen(){
if (localStorage.getItem('bd_first_test_offer_return_url').length == 0){return};
if($('div#dpModal-container:visible').length > 0){
var result = "success";
} else {
var result = "error";
}
checkAndShowPreviewJs('buyx', result);
$.ajax({cache: false,
contentType: "application/json; charset=utf-8",
dataType: "json",
type: "POST",
url: settings.app_root_url,
data: JSON.stringify({action_type: 'first_test_offer_seen', app: 'buyx', result: result}),
success: function(res) {
}})
}
function productPageTestOfferSeen(){
if (document.location.search.indexOf("test_product_offer=1") > -1){
if (document.location.search.indexOf("bundle_test_product_offer=1") > -1){
var appType = 'bundle';
var appVisible = $('div.ba-bundle-wrapper:visible').length > 0
if (appVisible == true){window.scrollTo(0, $('div.ba-bundle-wrapper:visible').offset().top - 100)}
} else if (document.location.search.indexOf("dp_test_product_offer=1") > -1){
var appType = 'dp';
var appVisible = $('div.ba-vol-wrapper:visible').length > 0
if (appVisible == true){window.scrollTo(0, $('div.ba-vol-wrapper:visible').offset().top - 100)}
}
if (appType){
if (appVisible == true){
var result = "success";
} else {
var result = "error";
}
checkAndShowPreviewJs(appType, result);
$.ajax({cache: false,
contentType: "application/json; charset=utf-8",
dataType: "json",
type: "POST",
url: settings.app_root_url,
data: JSON.stringify({action_type: 'first_test_offer_seen', app: appType, result: result}),
success: function(res) {
}})
}
}
}
function showVolDiscounts(data){
var source = $("#ba-discount-tiers").html();
var context = {
product_message: data.offer_product_message || "Buy at discounted prices",
vol_rows: data.vol_rows
};
var template = baHandlebars.compile(source);
var html = template(context);
$('div.ba-vol-wrapper').html(html);
productPageTestOfferSeen();
}
function baDelegate(data) {
if(data.vol_rows && data.vol_rows.length > 0 && (data.type == 'vd' || data.type == 'bundle')){
var vdElement = $("form[action*='/cart/add']").first();
if($('.ba-vol-wrapper').length == 0){
vdElement.after("");
}
showVolDiscounts(data)
}
if(data.ba_bundles){
window.booster.currentVariantId = getUrlParam('variant');
window.booster.currentHandle = lastUrlSegment();
if($('.ba-bundle-wrapper').length == 0){
var referenceElement,bundle_placed;
var bundle_wrapper= "";
if (!bundle_placed) {
referenceElement = $("form[action*='/cart/add']").first();
referenceElement.after(bundle_wrapper);
}
}
var isPreview = (document.location.search.indexOf("preview_offer=1") > -1);
var checkStock = false;
$(data.ba_bundles).each(function(i,ba) {
if (checkStock && !isPreview) {
var productHandles = ba.items.map(function(p){ return p.handle });
allBundleItemsInStock(productHandles,function(allInStock) {
//Show only if all products are in stock
if (allInStock){ showBoosterBundle(ba) }
})
} else {
//old version
showBoosterBundle(ba);
}
});
}
//Will return an instance or null if item is not an object.
var isObject = function(obj) { return (typeof obj === "object") ? obj : null;}
var discounts_present = isObject(data.discounts);
if (discounts_present) {
var upsellCollectionPresent = (isObject(data.discounts.upsell_collection_arr) && (data.discounts.upsell_collection_arr.collection || []).length > 0);
var upsellProductsPresent = function(){return ((isObject(data.discounts.upsell_arr) || []).length > 0)} //function because 'upsell_arr' updated in out_of_stock_feature_enabled = false version
//Check and run showBaUpsell
var checkBaUpsell = function () {
// Stop if no upsells at all
if (!upsellCollectionPresent && !upsellProductsPresent()) { return; }
var upsellArr = data.discounts.upsell_arr;
//Just get all product handles
var upsellProductHandles = upsellArr.map(function(p){ return p.handle })
var collectionHandles = (upsellCollectionPresent) ? [data.discounts.upsell_collection_arr.collection[0].handle] : []
//Get collection products and stock state
getVariantsInStock(upsellProductHandles,collectionHandles,false,function(productsStock) {
var collectionProductIds = []
var upsellObj = data.discounts.upsell_collection_arr;
var existingProductIds = upsellArr.map(function (item) { return item.id.toString() });
for (var productId in productsStock) {
if (existingProductIds.indexOf(productId) == -1) collectionProductIds.push(Number(productId))
}
var maxProducts = 20;
if (maxProducts 0) showBaUpsell(data);
})
}
//check if need to add upsells items from collections(ignored by stock version)
if (upsellCollectionPresent && false) {
addCollectionUpsells(data.discounts.upsell_collection_arr, data, function () {
checkBaUpsell()
})
}
else {
checkBaUpsell();
}
if ((isObject(data.notifications) || []).length > 0 && (data.discounts.upsell_arr || []).length == 0) {
showBoosterNotification(data.notifications,data)
}
if (isObject(data.discounts.cart) && isObject(data.discounts.cart.items)) {
showCartDiscounts(data.discounts)
}
}
reloadCurrency();
}
function showCartDiscounts(discounts) {
window.booster.discounts = discounts;
for (var i = 0; i " + item.original_price_format + "" + "" + item.discounted_price_format + "");
$(".booster-cart-item-line-price[data-key='" + item.key + "']").html("" + item.original_line_price_format + "" + "" + item.discounted_line_price_format + "")
}
$(".booster-cart-item-upsell-notes[data-key='" + item.key + "']").html(item.upsell_note);
$(".booster-cart-item-success-notes[data-key='" + item.key + "']").html(item.success_note);
};
//Avoid any actions if no discounts present in any form.
if (typeof discounts.discounted_price_html != "string") {
return
}
//Adjust cart totals only if positive discount present
if (discounts.positive_discount) { displayCartTotals(discounts)}
//WIP for zero discounts
if (discounts.zero_discount_only || window.booster.cart.total_price == 0){
$('form[action*="/cart"]').append("");
try{ window.booster.cart.attributes["ba_identifier"] = 1 } catch (ex){}
return
}
var checkout_selectors = ["input[name='checkout']", "button[name='checkout']", "[href$='checkout']", "input[name='goto_pp']", "button[name='goto_pp']", "input[name='goto_gc']", "button[name='goto_gc']", ".additional-checkout-button", ".google-wallet-button-holder", ".amazon-payments-pay-button"];
checkout_selectors.forEach(function(selector) {
var els = document.querySelectorAll(selector);
if (typeof els == "object" && els) {
for (var i = 0; i 0) {
$(".wh-original-cart-total span.wh-original-price").css("text-decoration", "line-through");
} else {
$(".wh-original-cart-total").css("text-decoration", "line-through");
}
$(".wh-cart-total").html("" + discounts.discounted_price_html + "");
if (discounts.summary_item_html) {
var boosterSummaryItemHtml = discounts.summary_item_html;
} else {
var boosterSummaryItemHtml = "";
}
//some cart_subtotal hiden
$('.subtotal .cart_savings.sale').hide();
$(".wh-cart-total").prepend("
" + boosterSummaryItemHtml + "
");
$(".wh-cart-total span").css("text-decoration", "none");
reloadCurrency()
}
function showBoosterNotification(notifications,data){
//no notification when we in selector mode.
if (window.selector_mode) return;
if ((getCookie('booster_notifications_closed') != 1) && notifications != ""){
var notification_placed = false;
var barHtml = "
" + notifications + "
X
";
if (window.booster.ba_page == 'cart') {
var refElementCart = $("div#PageContainer header div#shopify-section-header").first();
if(refElementCart.length != 0) notification_placed = true;
refElementCart.after(barHtml)}
if (!notification_placed){
var barElements = ["main", "div.content", "section.main-content", "div#content"];
barElements.forEach(function(el){
if ($('#booster-notification-bar').length == 0){
if (el == 'main'){
$(el).prepend(barHtml);
} else {
$(el).before(barHtml);
}
}
});
}
if ($('#booster-notification-bar').length > 0){
$('#booster-notification-bar').slideDown('slow');
}
}
}
function addBoosterBundle(e){
e.preventDefault();
var boosterBundleItems = [];
$(e.target).parents(".ba-product-bundle").find(".ba-product-wrapper").each(function() {
var i = {id: $(this).data("variant-id"),quantity: $(this).data("quantity")};
boosterBundleItems.push(i);
});
addBoosterItems(boosterBundleItems, function(){
setTimeout(function() {window.location.href = "/cart"}, 200)
});
}
function addBoosterUpsells(target){
var btn = $(target);
var boosterUpsellItems = [];
var container = btn.parents(".product-container");
var offer_id = btn.data("offer-id")
//Don't display offer anymore if one item selected.
hideUpsell(offer_id);
var i = {id: container.data("variant-id"),quantity: container.data("quantity")};
boosterUpsellItems.push(i);
addBoosterItems(boosterUpsellItems, function(){
setTimeout(function() {window.location.href = "/cart"}, 200)
});
}
function addBoosterItems(variants, callback) {
if (variants.length) {
var i = variants.shift();
$.ajax({
url: "/cart/add.js",
type: "POST",
dataType: "json",
data: i,
success: function(data) {
addBoosterItems(variants, callback)
},
error: function(data) {
if (typeof data == "object" && typeof data.responseJSON == "object" && typeof data.responseJSON.description == "string") {
alert(data.responseJSON.description)
}
if (typeof res == "string") {
alert(data)
}
}
})
} else {
if (typeof callback == "function") {
return callback()
}
setTimeout(function() {
window.location.reload()
}, 100)
}
}
function DiscountedPricingCheckout(e){
if ($("input[type='checkbox']#agree").length > 0 && $("input[type='checkbox']#agree:checked").length != $("input[type='checkbox']#agree").length) {
return
}
$(e.target).prop("disabled", 'disabled');
for (var i = 0; i 0){
notifyCalculationsInProgress();
$.ajax({
cache: false,
type: "POST",
url: settings.app_root_url,
data: JSON.stringify(window.booster),
dataType: 'json',
contentType: "application/json; charset=utf-8",
success: function(data) {
baDelegate(data)
}
});
}
setTimeout(function(){
if (typeof ga == "function"){ga(function(tracker) {window.gaclientId = tracker.get("clientId")})}
}, 1000);
function getRefreshDelayValue(){
var delaySubmit = '';
if( isMobileBrowser() ){
delaySubmit = "2";
}else{
delaySubmit = "0.5";
}
return parseFloat(delaySubmit) * 1000; // convert to milliseconds
}
var debutEditBtnExists = ($('div.cart__edit button.btn.cart__edit--active:visible').length > 0);
var qtyInputEvent = debutEditBtnExists ? "" : "input " ;
$(document).on(qtyInputEvent + 'change', "input.booster-quantity, input[name^='updates['], input[id^='updates_'], input[id^='Updates_']", function(e) {
var self = this;
e.preventDefault();
if($.trim($(this).val()) != '') {
notifyCalculationsInProgress();
//Delay cart submit to make input more user friendly specially on mobile
setTimeout(function(){ $(self).parents('form[action*="/cart"]').submit() }, getRefreshDelayValue());
};
});
if(window.booster.ba_page == 'cart'){
$(document).on('click', "td.cart-qty span.icon-plus, td.cart-qty span.icon-minus", function(e) {
e.preventDefault();
$(this).parents('form[action*="/cart"]').submit();
});
$(document).ajaxSuccess(function(evt,xhr,attrs) {
if (attrs && attrs.url == '/cart/change.js'){
window.location.reload();
}
});
setTimeout(function(){
$('.js-qty__adjust').off('click');
}, 500);
$(document).on('click', "div.js-qty .js-qty__adjust", function(e) {
e.preventDefault();
var currentValue = parseInt($(this).parents('div.js-qty').find('input').val());
if($(this).hasClass('js-qty__adjust--plus')){
var newValue = currentValue + 1
} else {
var newValue = currentValue - 1
}
$(this).parents('div.js-qty').find('input').val(newValue).change();
});
}
$(document).on('change', 'select.ba-variants', function(){
var option = $(this).find(":selected");
var price = baDisplayCents(option.data('price'));
var cont = option.parents('.ba-product-wrapper');
var img = option.data('img');
cont.find('.ba-price span.ba-sale').html(price);
cont.data("variant-id", option.val());
cont.find('img').attr('src', img);
reloadCurrency();
return false;
});
$(document).on('change', '#dpModal-container select.ba-variants', function(){
var option = $(this).find(":selected");
var upsellCont = option.parents('.ba-product-bundle');
var cont = option.parents('.product-container');
var discountMethod = upsellCont.data('discount-method');
var discountValue = upsellCont.data('discount-value');
var discountApplies = upsellCont.data('discount-applies');
var compare_at_price = option.data('compare-at-price');
var price = baDiscountedPrice(option.data('price'), discountApplies, discountMethod, discountValue);
var img = option.data('img');
cont.data("variant-id", option.val());
cont.find('span.ba-sale').html(price);
cont.find('img').attr('src', img);
reloadCurrency();
return false;
});
$(document).on('click', ".add-booster-bundle", function(e) {
e.preventDefault();
addBoosterBundle(e);
});
$(document).on('click', ".add-upsells", function(e) {
e.preventDefault();
addBoosterUpsells(e.target);
var offerId = $(this).data('offerId')
registerEvent('offer_add_cart',{app_type: 'buyx',offer_id: offerId})
});
$(document).on($.dpModal.BEFORE_CLOSE, function(event, modal){
var link = $('#dpModal-container').find('.no-thanks a');
var offerId = link.data('offer-id');
hideUpsell(offerId)
refreshIfProductAdded();
});
function hideUpsell(offerId){
var currentSkipIds = getCookie('ba-skip-ids');
if (currentSkipIds && currentSkipIds !='') currentSkipIds += ','
var allSkipIds = currentSkipIds + offerId;
setCookie('ba-skip-ids', allSkipIds, 0);
}
function refreshIfProductAdded(){
return true;
}
$(document).on('click', '.no-thanks a', function(){
var link = $(this);
var offerId = link.data('offer-id')
hideUpsell(offerId)
$.dpModal.close()
return false;
});
$(document).on('click', "button#apply-booster-discount", function(e) {
e.preventDefault();
setCookie('booster_discount_' + window.booster.cart.token, $('input[id=booster-discount-code]:visible').val().trim())
window.location.reload();
});
$(document).on('click', "div#booster-close-notification", function(e) {
e.preventDefault();
//var closedNotifications = getCookie('booster_notifications_closed')
setCookie('booster_notifications_closed', 1, 0.01);
$('#booster-notification-bar').slideUp('slow');
});
$(document).on('click','.booster-variants-container select.ba-variants',function() {
//Just an alert in case all variants are out of stock
if ($(this).children('option').length