-
-
Save Sally165/f13262bd36bb640e9c391e6400232667 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- PAGEFLY CART HELPER - DO NOT DELETE --> | |
<script> | |
try { | |
setTimeout(function () { | |
window.__pagefly_helper_store__ && | |
window.__pagefly_helper_store__.subscribe(function (product) { | |
$.getJSON('/cart.json').then(cart => { | |
$.get(theme.routes.cart_url, function (data) { | |
var cartUpdateSelector = '#site-control .cart:not(.nav-search), [data-section-type="cart-template"]'; | |
var $newCartObj = $($.parseHTML('<div>' + data + '</div>')).find(cartUpdateSelector); | |
$(cartUpdateSelector).each(function (index) { | |
$($newCartObj[index]).find('[data-cc-animate]').removeAttr('data-cc-animate'); | |
$(this).replaceWith($newCartObj[index]); | |
$(this).parent().find('[data-cc-animate]').removeAttr('data-cc-animate'); | |
}); | |
}); | |
var thumbUrl = theme.Shopify.formatImage(product.image, '300x'); | |
var img = new Image(); | |
img.src = thumbUrl; | |
var offset = 25; | |
var nav = theme.Nav(); | |
var variantHtml = ""; | |
if (product.selling_plan_allocation && product.selling_plan_allocation.selling_plan.name) { | |
variantHtml += "<p class=\"cart-product__content__meta\">".concat(product.selling_plan_allocation.selling_plan.name, "</p>"); | |
} | |
if (product.options_with_values && product.options_with_values.length) { | |
for (var _i2 = 0; _i2 < product.options_with_values.length; _i2++) { | |
var option = product.options_with_values[_i2]; | |
if (option.name !== "Title" && option.value !== "Default Title") { | |
variantHtml += "<p class=\"cart-product__content__meta\">".concat(option.name, ": ").concat(option.value, "</p>"); | |
} | |
} | |
} | |
if (nav.bar.getPositionSetting() !== "inline") { | |
offset = nav.bar.height(); | |
} | |
showThemeModal([ | |
'<div id="added-to-cart" class="theme-modal theme-modal--small" role="dialog" aria-modal="true" aria-labelledby="added-to-cart-title">', | |
"<div class=\"inner\" style=\"top:".concat(offset, "px\">"), | |
'<a href="#" data-modal-close class="modal-close">×</a>', | |
'<h4 id="added-to-cart-title">' + theme.icons.tick + theme.strings.productAddedToCart + '</h4>', '<div class="cart-product">', | |
"<div class=\"cart-product__image\"><img src=\"".concat(thumbUrl, "\" alt=\"").concat(product.image, "\"/></div>"), | |
'<div class="cart-product__content">' + '<p class="cart-product__content__title">', product.product_title, '</p>' + "".concat(variantHtml ? variantHtml : '') + '</div>', | |
'</div>', '<p class="links "><a href="/cart" class="button alt">View Bag</a><a href="/checkout" class="button button--checkout" [data-cc-checkout-button]="">Checkout</a> </p>', '</p>', '</div>', '</div>'].join(''), "added-to-cart", null); | |
}); | |
}); | |
}, 2500); | |
} catch (e) { | |
console.warn(e); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment