Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- (function() {
- try {
- var URL = window.location.origin + '/cart/';
- var parser = new DOMParser();
- var doc = '';
- var data = null;
- var xhr = new XMLHttpRequest();
- xhr.withCredentials = true;
- xhr.addEventListener('readystatechange', function () {
- if (this.readyState === 4) {
- doc = parser.parseFromString(this.responseText, 'text/html');
- var totalCartAmount = doc.querySelector('.order-total .woocommerce-Price-amount.amount');
- if (totalCartAmount) {
- totalCartAmount = totalCartAmount.textContent;
- totalCartAmount = parseFloat(totalCartAmount.replaceAll('₪', ''));
- window.totalCartPrice = totalCartAmount;
- }
- }
- });
- xhr.open('GET', URL);
- xhr.setRequestHeader('cache-control', 'no-cache');
- xhr.send(data);
- } catch(error) {
- console.log(error);
- }
- })();
- </script>
Add Comment
Please, Sign In to add comment