1(function(wp) { 2 const { select, subscribe } = wp.data; 3 const STORE_MAIN = 'wc/store'; 4 const CART_STORE_OLD = 'wc/store/cart'; 5 const CHECKOUT_STORE_OLD = 'wc/store/checkout'; 6 7 function getCartData() { 8 const storeMain = select(STORE_MAIN); 9 const storeCart = select(CART_STORE_OLD); 10 11 if (storeMain && typeof storeMain.getCart === 'function') { 12 return storeMain.getCart(); 13 } 14 if (storeCart && typeof storeCart.getCartData === 'function') { 15 return storeCart.getCartData(); 16 } 17 return null; 18 } 19 20 function getCheckoutData() { 21 const storeMain = select(STORE_MAIN); 22 const storeCheckout = select(CHECKOUT_STORE_OLD); 23 24 if (storeMain && typeof storeMain.getCheckout === 'function') { 25 return storeMain.getCheckout(); 26 } 27 if (storeCheckout && typeof storeCheckout.getCheckoutData === 'function') { 28 return storeCheckout.getCheckoutData(); 29 } 30 return null; 31 } 32 33 function updateLabels() { 34 document.querySelectorAll('.wc-block-components-totals-coupon > .wc-block-components-panel__button').forEach(el => { 35 if (el.textContent.trim() === 'Add coupons') { 36 el.textContent = 'Î ÏοÏθήκη ÎºÎ¿Ï ÏονιοÏ'; 37 } 38 }); 39 } 40 41 // Run once on page load 42 document.addEventListener('DOMContentLoaded', updateLabels); 43 44 // Watch for cart or checkout updates 45 // subscribe(() => { 46 // const cart = getCartData(); 47 // const checkout = getCheckoutData(); 48 // if (cart || checkout) { 49 // updateLabels(); 50 // } 51 // }); 52})(window.wp);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.