Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- (function () {
- var FREE_SHIPING_MAX_LIMIT = 199;
- function updateCurrentTotalPrice() {
- var pageTotalPrice = document.querySelector('.minicart-wrapper .subtotal .price');
- if (pageTotalPrice) {
- pageTotalPrice = pageTotalPrice.textContent;
- pageTotalPrice = parseInt(pageTotalPrice.replace('₪', ''));
- } else {
- pageTotalPrice = 0;
- }
- window.localStorage.setItem('adoricTotalPrice', pageTotalPrice.toFixed(0));
- var event = document.createEvent('Event');
- event.initEvent('adoricTotalCartUpdated', true, true);
- document.querySelector('body').dispatchEvent(event);
- document.querySelector('body').addEventListener('adoricTotalCartUpdated', function (e) {
- }, false);
- }
- updateCurrentTotalPrice();
- document.querySelector('body').addEventListener('click', function(event) {
- if(event.target.closest('.btn-remove') || event.target.closest('.btn-cart')) {
- updateCurrentTotalPrice();
- setTimeout(updateCurrentTotalPrice, 1500);
- setTimeout(updateCurrentTotalPrice, 4000);
- }
- });
- var addToCartForm = document.querySelector('#product_addtocart_form');
- if (addToCartForm) {
- addToCartForm.addEventListener('submit', updateCurrentTotalPrice);
- }
- })();
- </script>
Advertisement
Add Comment
Please, Sign In to add comment