Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- (function () {
- var FREE_SHIPPING_MESSAGE = 'Free Shipping unlocked';
- var FREE_SHIPPING_ICON = 'https://static.adoric.com/3db4186a-8e70-4e02-a7b7-68506303bf77.svg';
- var shippingText = document.querySelector('.mb-2 .no-shipping');
- var shippingIcon = document.querySelector('.mb-2 .no-shipping img');
- var productsInCart = document.querySelectorAll('div.col-7 [data-variant-id]');
- var whiteList = ['40513507622954', '40513507655722'];
- var quantityForFreeShiping = 0;
- productsInCart.forEach(function (product) {
- var isProductInTheCart = whiteList.some(function (item) {
- return item == product.getAttribute('data-variant-id');
- });
- if (isProductInTheCart) {
- var quantity = parseInt(product.getAttribute('data-qty'));
- if (quantity) {
- quantityForFreeShiping += quantity;
- }
- }
- });
- if (quantityForFreeShiping >= 3 && shippingText && shippingIcon) {
- shippingText.textContent = FREE_SHIPPING_MESSAGE;
- shippingIcon.src = FREE_SHIPPING_ICON;
- shippingText.insertAdjacentElement('afterbegin', shippingIcon);
- }
- })();
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement