1(function ($) { 2 $(document).ready(function () { 3 if (!window.elementorFrontend || !window.elementorFrontend.getElements) { 4 return; 5 } 6 const menuCarts = window.elementorFrontend 7 ?.getElements() 8 ?.$body?.find(".elementor-widget-woocommerce-menu-cart"); 9 menuCarts.each((_, el) => { 10 const settings = $(el).data("settings"); 11 if (!settings) { 12 return; 13 } 14 if (settings.automatically_open_cart == null) { 15 return; 16 } 17 const currentValue = settings.automatically_open_cart; 18 settings.automatically_open_cart = "no"; 19 $(el).data("settings", settings); 20 setTimeout(() => { 21 settings.automatically_open_cart = currentValue; 22 $(el).data("settings", settings); 23 }, 1000); 24 }); 25 }); 26 27 /** 28 * Integrate with YayExtra product total 29 */ 30 if (!window.wp?.hooks?.addFilter) { 31 return; 32 } 33 window.wp.hooks.addFilter( 34 "yaye_total_price_hook", 35 "yaydp", 36 function (html, total) { 37 const extraTotalPrice = $(".yayextra-total-price"); 38 if (extraTotalPrice.closest(".product").length < 1) { 39 return html; 40 } 41 const yaydpDiscountedData = extraTotalPrice 42 .closest(".single-product-wrapper") 43 .find(".yaydp-product-discounted-data"); 44 if (yaydpDiscountedData.length < 1) { 45 return html; 46 } 47 48 const minRate = yaydpDiscountedData.data("min-rate"); 49 const maxRate = yaydpDiscountedData.data("min-rate"); 50 51 if (minRate >= 1) { 52 return html; 53 } 54 55 const discounted = total * minRate; 56 57 function formatPrice(price) { 58 window.accounting.settings.currency.symbol = 59 window.yaydp_frontend_data.currency_settings.symbol; 60 window.accounting.settings.currency.decimal = 61 window.yaydp_frontend_data.currency_settings.decimalSeparator; 62 window.accounting.settings.currency.thousand = 63 window.yaydp_frontend_data.currency_settings.thousandSeparator; 64 window.accounting.settings.currency.precision = 65 window.yaydp_frontend_data.currency_settings.precision; 66 return ` 67 <span class="woocommerce-Price-amount amount">${window.accounting.formatMoney( 68 price 69 )}</span> 70 `; 71 } 72 73 return ` 74 <del>${formatPrice(total)}</del> 75 ${formatPrice(discounted)}`; 76 } 77 ); 78})(window.jQuery);
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.