Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- (function() {
- var FREE_SHIPPING_MINIMUM_PRICE = 100;
- var FREE_SHIPPING_MAXIMUM_PRICE = 198;
- var FREQUENCY_LIMITATION_PER_SESSION = 2;
- function checkFreeShipping() {
- var pageTotalPrice = document.querySelector('.minicart-wrapper .subtotal .price');
- if (pageTotalPrice) {
- pageTotalPrice = pageTotalPrice.textContent;
- pageTotalPrice = pageTotalPrice.replace('₪', '');
- pageTotalPrice = parseInt(pageTotalPrice);
- }
- var showedByCurrentSession = parseInt(sessionStorage.getItem('isAdoricFreeShipingShowed'));
- if (!showedByCurrentSession) {
- showedByCurrentSession = 0;
- }
- if (adoric &&
- pageTotalPrice > FREE_SHIPPING_MINIMUM_PRICE &&
- pageTotalPrice < FREE_SHIPPING_MAXIMUM_PRICE &&
- showedByCurrentSession < FREQUENCY_LIMITATION_PER_SESSION) {
- adoric.trigger('show_AdoricFreeShiping');
- showedByCurrentSession++;
- sessionStorage.setItem('isAdoricFreeShipingShowed', showedByCurrentSession);
- }
- }
- var waitPageTriggerElement = setInterval(function() {
- var pageTriggerElements = document.querySelector('#product_addtocart_form .btn-cart');
- if (pageTriggerElements) {
- clearInterval(waitPageTriggerElement);
- pageTriggerElements.addEventListener('click', function() {
- setTimeout(checkFreeShipping, 2500);
- });
- }
- }, 1000);
- setTimeout(function() {
- clearInterval(waitPageTriggerElement);
- }, 7000);
- })();
- </script>
Advertisement
Add Comment
Please, Sign In to add comment