window.is_EU = false;console.log('NEW TAX DETERMINATION - TAX INCLUDED: false'); (function(){ var loadScript = function(url, callback) { var script = document.createElement("script"); script.type = "text/javascript"; if (script.readyState){ script.onreadystatechange = function(){ if (script.readyState == "loaded" || script.readyState == "complete") { script.onreadystatechange = null; callback(); } }; } else { script.onload = function() { callback(); }; } script.src = url; document.getElementsByTagName("head")[0].appendChild(script); }; var fix = function($) { var PriceFormatter = class { constructor() { this.vat_rate = 1.19; this.target_vat_rate = 1.19; this.taxes_included = false; this.customer_country = 'US'; this.is_merchant_eu = false; this.is_merchant_uk = false; this.is_customer_eu = false; this.apply_uk_vat = false; this.always_net = false; this.show_both_prices = false; this.apply_target_vat = false; this.show_prices_inc_vat_for_customer = true; this.style = ''; this.inc_style = ''; this.brackets = false; this.inc_vat_first = false; this.no_line_break = false; this.always_show_ex_vat_txt = false; if (typeof m4u_ptxt !== 'undefined') this.inc_vat_txt = m4u_ptxt; else this.inc_vat_txt = 'inc VAT'; if(this.inc_vat_txt=='') this.inc_vat_txt = '\u0020'; this.inc_vat_txt = ''+this.inc_vat_txt+''; this.applied_rate; if(false || 1==2) { console.log('taxes included: '+ this.taxes_included ); console.log('local VAT rate: '+ this.vat_rate ); console.log('target VAT rate: '+ this.target_vat_rate ); console.log('apply target VAT rate: '+ this.apply_target_vat ); console.log('customer country: US' ); console.log('is customer tax exempt?: false' ); } } // extract the price from the price element as a float formatPriceDisplay(node) { var matcher1; var matcher2; var matcher_blank = /\d{1,3}( \d{3})*((\.|,)\d{1,2})?/; var matcher_dot = /\d{1,3}(,\d{3})*(\.\d{1,2})?/; var matcher_comma = /\d{1,3}(\.\d{3})*(,\d{1,2})?/; var matcher_dot_simple = /(\d)*(\.)(\d{1,2})/; var matcher_comma_simple = /(\d)*(,)(\d{1,2})/; var matcher_simple = /(\d){1,10}/; var txt = node.data; var txt_old = ''; var match=null; // apply different regular expressions and identify the proper matcher for different price formats // blank as a group separator, either dot or comma as a decimal separator var match_blank = txt.match(matcher_blank); // dot as a decimal separator, comma as a group separator var match_dot = txt.match(matcher_dot); // comma as a decimal separator, dot as a group separator var match_comma = txt.match(matcher_comma); // dot as a decimal separator, no group separator var match_dot_simple = txt.match(matcher_dot_simple); // comma as a decimal separator, no group separator var match_comma_simple = txt.match(matcher_comma_simple); // no separator of any kind var match_simple = txt.match(matcher_simple); var full_match_blank = ''; if(match_blank!=null) full_match_blank=match_blank[0]; if(match_dot!=null) match_dot=match_dot[0]; if(match_comma!=null) match_comma=match_comma[0]; if(match_dot_simple!=null) match_dot_simple=match_dot_simple[0]; if(match_comma_simple!=null) match_comma_simple=match_comma_simple[0]; if(match_simple!=null) match_simple=match_simple[0]; /* no price > show original node, remove clone and exit */ if(match_dot==null && match_comma==null && match_dot_simple==null && match_comma_simple==null && match_blank==null) { $(node.parentNode).show(); $(node.parentNode).next().remove(); return; } if(match_dot_simple==null) match_dot_simple=''; if(match_comma_simple==null) match_comma_simple=''; if(match_simple==null) match_simple=''; if(match_dot_simple.length > match_dot.length) match_dot = match_dot_simple; if(match_comma_simple.length > match_comma.length) match_comma = match_comma_simple; var dec_sep='.'; var group_sep =','; match= match_dot; if(match_comma.length > match_dot.length) { dec_sep=','; group_sep ='.'; match =match_comma; } if(match_simple.length > match_dot.length && match_simple.length > match_comma.length ) { dec_sep=''; group_sep =''; match =match_simple; } if(full_match_blank.length > match_simple.length && full_match_blank.length > match_dot.length && full_match_blank.length > match_comma.length) { dec_sep= match_blank[3]; if(dec_sep==null) dec_sep=''; group_sep =' '; match =full_match_blank; } var price = match; txt_old = txt; var perc = txt_old.indexOf('%'); if( price==0 || perc != -1 ) { $(node.parentNode).show(); $(node.parentNode).next().remove(); return; } var price_normalized = price; if(group_sep==' ') price_normalized = price_normalized.replace(' ',''); if(dec_sep=='.') price_normalized = price_normalized.replace(/,/g,''); else price_normalized = price_normalized.replace(/\./g,''); price_normalized = price_normalized.replace(/,/g,'.'); if(isNaN(price_normalized)) return; return this.calculatePrices(price_normalized,dec_sep,group_sep,price,txt,node); } netToGross(price_normalized,rate) { return ( price_normalized * rate) .toFixed(2); } grossToNet(price_normalized,rate) { return (price_normalized/rate).toFixed(2); } grossToNetPrecise(price_normalized,rate) { return (price_normalized/rate); } formatPrice(price,decimal_sep,group_sep,potential_trunc) { // add trailing zeros if truncation isn't selected if(2 == 0 && 0 == 0 && potential_trunc) price += '.00'; price = price.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,"); //if(group_sep==' ') // price = price.replace(/,/g,' '); if(decimal_sep==',') { price = price.replace(/,/g,'#'); price = price.replace(/\./g,','); price = price.replace(/#/g,'.'); if(group_sep==' ') price = price.replace(/./g,' '); } else { if(group_sep==' ') price = price.replace(/,/g,' '); } return price; } calculatePrices(price_normalized,decimal_sep,group_sep,price_original,original_text,node) { var net_price,net_price_normal, net_price_precise, gross_price, gross_price_normal, gross_price_target_vat, gross_price_target_vat_normal,display_mode, ex_price, inc_price,txt; var trunc_net = false; var trunc_gross = false; var trunc_gross_target_vat = false; if(this.taxes_included) { var rate = this.vat_rate; if(this.apply_target_vat) rate = this.target_vat_rate; net_price = this.grossToNet(price_normalized,this.vat_rate); net_price_precise = this.grossToNetPrecise(price_normalized,this.vat_rate); gross_price_target_vat = this.netToGross(net_price_precise,this.target_vat_rate); gross_price = price_normalized; //net_price = this.grossToNet(price_normalized,rate); //if taxes are included, the gross price stays the same //gross_price_target_vat = gross_price; if(2==0) gross_price = parseFloat(gross_price).toFixed(2); //net price is calculated > truncate price if configured trunc_net = true; } else { net_price = price_normalized; gross_price = this.netToGross(price_normalized,this.vat_rate); gross_price_target_vat = this.netToGross(net_price,this.target_vat_rate); //gross price is calculated > truncate prices if configured trunc_gross = true; trunc_gross_target_vat =true; } net_price_normal = net_price; gross_price_normal = gross_price; gross_price_target_vat_normal = gross_price_target_vat; // format prices net_price = this.formatPrice(net_price,decimal_sep,group_sep,trunc_net); gross_price = this.formatPrice(gross_price,decimal_sep,group_sep,trunc_gross); gross_price_target_vat = this.formatPrice(gross_price_target_vat,decimal_sep,group_sep,trunc_gross_target_vat); // EU MERCHANT, UK CUSTOMER if(this.always_net ) display_mode = 'ONLY_NET'; else if(this.customer_country == 'GB' && this.is_merchant_eu && '' != 'IE') { // APPLY UK VAT RATE if(this.apply_uk_vat) { // SALES THRESHOLD EXCEEDED - SHOW ONLY NET PRICE if(price_normalized > 135) display_mode = 'ONLY_NET'; // PRICE NEEDS TO BE DISPLAYED WITH UK VAT else { if(this.show_both_prices) display_mode = 'NET_AND_TARGET_VAT'; else display_mode = 'ONLY_TARGET_VAT'; } } // DO NOT APPLY UK VAT RATE else { if(this.show_both_prices) display_mode = 'NET_AND_TARGET_VAT'; else if(this.show_prices_inc_vat_for_customer) display_mode = 'ONLY_MERCHANT_VAT'; else display_mode = 'ONLY_NET'; } } // EU MERCHANT, EU CUSTOMER else if(this.is_customer_eu && this.is_merchant_eu ) { console.log(this.show_prices_inc_vat_for_customer); // APPLY DESTINATION VAT RATE if(this.apply_target_vat) { if(this.show_both_prices) display_mode = 'NET_AND_TARGET_VAT'; else if( ! this.show_prices_inc_vat_for_customer ) display_mode = 'ONLY_NET'; else display_mode = 'ONLY_TARGET_VAT'; } else { if(this.show_both_prices) display_mode = 'NET_AND_MERCHANT_VAT'; else if( ! this.show_prices_inc_vat_for_customer ) display_mode = 'ONLY_NET'; else display_mode = 'ONLY_MERCHANT_VAT'; } } // UK MERCHANT WITH OSS, EU CUSTOMER else if(this.is_customer_eu && this.is_merchant_uk && this.apply_target_vat ) { // APPLY DESTINATION VAT RATE if(this.show_both_prices) display_mode = 'NET_AND_TARGET_VAT'; else display_mode = 'ONLY_TARGET_VAT'; } // DISPLAY PRICES INC VAT IN THE CUSTOMER COUNTRY (USUALLY CC = MC) else if(this.show_prices_inc_vat_for_customer) { if(this.show_both_prices) display_mode = 'NET_AND_MERCHANT_VAT'; else display_mode = 'ONLY_MERCHANT_VAT'; } // DISPLAY PRICES EX VAT IN THE CUSTOMER COUNTRY else { display_mode = 'ONLY_NET'; } if(false && false) { display_mode = 'ONLY_NET'; } if(false) { console.log('DISPLAY MODE: ' + display_mode); } var exemptify_node = $(node.parentNode).next(); var itemprop_price = 0; var has_itemprop = false; if( $(exemptify_node).attr('itemprop') === 'price') has_itemprop = true; switch(display_mode) { case 'ONLY_NET': itemprop_price = net_price_normal; original_text = original_text.replace(price_original, net_price); $('.product-single__policies,.product__policies,.ProductMeta__TaxNotice,.product__tax,.tax-note').hide(); break; case 'ONLY_MERCHANT_VAT': itemprop_price = gross_price_normal; original_text = original_text.replace(price_original, gross_price); this.applied_rate = this.vat_rate; break; case 'ONLY_TARGET_VAT': itemprop_price = gross_price_target_vat_normal; original_text = original_text.replace(price_original, gross_price_target_vat); this.applied_rate = this.target_vat_rate; break; case 'NET_AND_TARGET_VAT': itemprop_price = gross_price_target_vat_normal; inc_price = original_text.replace(price_original, gross_price_target_vat); net_price = original_text.replace(price_original, net_price); this.applied_rate = this.target_vat_rate; $('.product-single__policies,.product__policies,.ProductMeta__TaxNotice,.product__tax,.tax-note').hide(); break; case 'NET_AND_MERCHANT_VAT': itemprop_price = gross_price_normal; inc_price = original_text.replace(price_original, gross_price); net_price = original_text.replace(price_original, net_price); this.applied_rate = this.vat_rate; $('.product-single__policies,.product__policies,.ProductMeta__TaxNotice,.product__tax,.tax-note').hide(); break; } this.findOffer(price_normalized,itemprop_price); if(has_itemprop) $(exemptify_node).attr('content',itemprop_price); if(display_mode == 'NET_AND_TARGET_VAT' || display_mode == 'NET_AND_MERCHANT_VAT' ) { net_price = (m4u_ex_vat_postfix_txt != null) ? net_price + ' ' + m4u_ex_vat_postfix_txt : ''; if(this.brackets) net_price = '('+ net_price + ')'; net_price = ''+ net_price + ''; inc_price = ''+ inc_price + ' ' + this.inc_vat_txt + ''; if(this.inc_vat_first) txt= inc_price + price_sep + net_price; else txt= net_price + price_sep + inc_price; } else if(display_mode == 'ONLY_MERCHANT_VAT' || display_mode == 'ONLY_TARGET_VAT') { txt = original_text + ' ' + this.inc_vat_txt; } else if(display_mode == 'ONLY_NET') { if(this.always_show_ex_vat_txt) txt = (m4u_ex_vat_postfix_txt != null) ? original_text + ' ' + m4u_ex_vat_postfix_txt : original_text; else txt = original_text; } if(this.no_line_break!=1) txt += '
'; var applied_rate_formatted = ((this.applied_rate-1).toFixed(2) * 100) + '%'; txt = txt.replace(/#VAT_RATE#/,applied_rate_formatted); return txt; } findOffer(price,new_price) { if (window.product_json == null ) return false; if (window.product_json['offers'] == null ) return false; // console.log(window.product_json ); for(var i=0; i' : ' | '; // if we need to apply the VAT rate of the customer country //var target_vat_rate = 1.4; var apply_target_vat = false; var needs_uk_vat = false; var target_vat = 1.19; // are prices including or excluding VAT? var remove_tax = (false) ? 1 : 0; // do taxes need to be removed (prices include VAT and customer country outside of merchant economic area) var needs_tax_removal = 0; var no_line_break = false; var init_delay = 0; formatter = new PriceFormatter(); function setCookie() { sessionStorage.setItem('exemptify_authorized', 'true'); } function delCookie() { sessionStorage.clear(); } function getCookie() { var auth = sessionStorage.getItem('exemptify_authorized'); if(auth=='true') return true; return false; } var cartDrawerArr = [ /* smile */ '#cart-box' ]; var drawersel = cartDrawerArr.join(); var selArr = [ /* Boundless */ '.product-item__price-wrapper,.product__price--reg.js-price,.js-price,.product-item__price--reg,.product__price--reg,.on-sale', /*Jumpstart & Minimal*/ '.grid-link__meta,.product-single__price,.cbb-price-digits,div.grid__item.one-third.text-right > span,.product-single__sale-price,.cart__subtotal-price,.grid-link__org_price', /*Venture*/ '.product-card__price,.cart__item-total,.cart__subtotal,.product-card__regular-price,.dualPrice', /*Simple*/ '.product__price,td[data-label="Price"] > span,.cart__table-cell--line-price > span,.product__price--on-sale,.sh-price-varies', /*Classic*/ '.grid-link__meta > strong,div.grid__item.one-third > span', /*Pop*/ 'span#productPrice,.cart__original-price', /*Brooklyn*/ '.cart__price,.grid-product__price,.ajaxcart__subtotal,.options-additional-item,.tb-cart-total-price,.tb-cart-price,.tb-ajaxcart__price', /*Supply*/ 'div.product-item--price small, div.grid-item.one-third.medium-down--one-third.medium-down--text-left.text-right small,span#bk-cart-subtotal-price small,.cart-original-price', /*Label*/ 'p.price,sspan[itemprop="price"],span.feature-copy,div.recolizePrice', /*Classic*/ 'span.money,.grid__item.large--one-fifth.large--display-table-cell.medium--two-thirds>strong', /* Optimal */ '.pr_price', /*Parallax*/ 'span.price > span,span.current_price,p.subtotal_amount>strong,p.price_total,strong.price,span.was_price,span.snize-price', /*Supply BOLD*/ '.medium-down--one-third.text-right>span.h2,span.h1.cart-subtotal--price,span.h1.cart-subtotal--price > small,.medium-down--one-third.text-right>span.h2>span.money,#productPrice-product-template > span,td[data-label=Price] span,td[data-label=Total] span,span.cart__subtotal span', /*Debut*/ '.product-price__price,#ComparePrice-product-template,#ProductPrice-product-template,#ProductPrice-product-pre-order-template,.cart__price-wrapper.cart-flex-item,.text-right.small--hide>div,.price-item,.cart__price-wrapper,.cart__row>.text-right,.cart-subtotal__price,dd[data-cart-item-regular-price],span[data-cart-item-regular-price],.predictive-search-item__price,.cart__total__money', /* Maranello */ '.totals-subtotal-value', /*Palo Alto*/ 'h2#ProductPrice>span,h2#ProductPrice,span.h3.price,h3.cart__subtotal.price>span,s.reduced-price', /* Refresh */ '.finalPrice', /* Minimog */ '.m-price-item,.m-cart-item__price--regular,.m-cart__subtotal--price', /*Canopy*/ 'div.price.ftc>span.amount,div.product-price,div.cart-summary-subtotal>span.amount,span.price.ftc,div.price>h5,div.half.column.align-right>h2', /*Dividio Widget*/ '.divido-widget-launcher>a', /*InstantSearch*/ '.isp_price_compare_at_price_exist,.isp_section_header,.ui-autocomplete.ui-front.ui-menu.ui-widget.ui-widget-contentx.ui-corner-all', /* RonDorff */ '.category__price,.js-article-price,.bag__counter__price', /* Store984 */ '.so-cart-item-line-price,.so-cart-original-total', /* Symmetry */ 'span.price,h2.price-area>span.price,h2.price-area>span.current-price,div.line-total,h2.subtotal.h1-style', /* Basel */ '.price>del,.price>ins,#old-product-price,#product-price,div.product-grid-item > span.price,span#product-price,span.shopify-Price-amount.amount', /* Lorenza */ '.title.gridJustify span', /* Sunrise*/ 'span.price-money', /* Story */ '.price-info', /* Enterprise */ '.price__current', /* Taskhusy */ '#bk-cart-subtotal-price', /* Split */ '#CartTotal > span,div.content>span.price', /* Yanka */ '.pt-price,.pt-price-01,.pt-price-02', /* CBT */ 'td.product-price,td[data-label=Price]>strong,td.cart-line-price,p.cart-totals-accent>span', /* Testament */ '.product-price,.prod-price,.cart-price,.cart-total,#basket-right>h4,.onsale,.was', /* Shoptimized */ '.booster-cart-item-line-price,.wh-original-cart-total,.ls-message-param.money', /* Custom*/ '.price_min,.price_max,.exemptify_h2', /* Yourstore */ '.price-box > span,.shopping-cart-table__product-price,#subtotal>td,#grandtotal>td', /* Embrava */ 'h2.price,td.price,span.total>strong', /* Mojave */ '.price__regular', /* Narrative */ '.product__current-price,.card__price,.cart-item__price,.cart-footer__subtotal,.card__price--sale,.card__price--regular', /* Avone */ '#ProductPrice-quickView', /* Gemini */ '.product-price--current,.product-info__price--current,td[data-label=Price],td[data-label=Total],.cart__total__value', /* Blockshop */ '.product-price--original', /* Elextron */ '.nt-product-item-price,td[data-label="Total"]>span,span#CartCost', /* Buildify */ '.bdf-img-box-price > span', /*Gecko*/ '.product-info>span.price,td.product-subtotal', /* Prestige */ '.Price,.Price>span,button.Cart__Checkout>span,.Cart__Total span,.ProductItem__PriceList', /* Unero */ '.price-new > .amount,.product-subtotal > .amount', /* Free shipping threshold */ '.content_threshold>strong>span.amount', /* Hulkapps */ '.original_price,.ajaxcart__price,.discounted_price,.hulkapps-cart-original-total,.hulkapps-cart-total,.hulkapps-cart-item-price,.hulkapps-cart-item-line-price,[data-hulkapps-ci-price],.cart-template__line-price,[data-hulkapps-cart-total]', /* General */ '.product-price-wrap,.subtotal', /* Ella */ '.regular-product span,.old-price,.special-price,.special-price>span,.total-price span,.fox-cart-item-line-price,.accessory-price', /* Omega */ 'div.price,span.compare-price,div.product--price span', /* Ella */ 'div.cart-collateral>span.price,p.total>span.price,.prices>.price,.info>.price', /* Loft */ 'p.product-price,.js-prod-price,.js-cart-item-price', /* Impulse */ '.grid-product__price--original,.product__price-savings,.product-price__sale,.tb-product-compare-price,.wh-original-price', /* Turbo */ '.price>.money,.item-pricing,.sale', /* Kagami */ '.product-meta__price,.product-item__price,.mini-cart__total-price,.cart-item__subtotal,.cart__total,.mini-cart-item__line-price', /* Electro */ '.price-compare,.price-sale', /* Focal */ '.product-sticky-form__price', /* Empire */ '.money,.price--main>span', /* Frontpage */ '.field-price,:not(.smarte-review-stars) > .total,.itemprice,.saw-cart-original-total', /* Takoon */ '.price__value,.cart-menu__total-text', /* Tony Templates */ '.full-total-js,.cart-total>span:not(.cart-qty),.new-price', /* Venue */ '.hidePrices', /* Pipeline */ '.buttonPrice', /* California */ 'h3.price', /* Electro */ '.addcart-modal-subtotal,.cart-item-total-price,.item-price,.item-total', /* Modular */ '.product-normal-price,.cart-product-total-price,.popover-item-price,.mosaic__product-price,.product-compare-price,.product-sale-price,.cart-product__total-price,.mw-price', /* Streamline */ '.sale-price', /* Code Basetheme */ '.variant-option-price,.ajax-notification-product-price', /* Store Theme */ '.usf-price', /* Broadcast */ '.item__price--final', /* Wokiee */ '.tt-price', /* Request for Quote */ '.sc-shopify-qs-product-price', /* Warehouse */ '.line-item__price,.cart-recap__price-line-price,.search-bar__item-price,.tdf-cart-total-parent,#total-cost', /* Legend*/ '.total-price', /* Athens */ '.dfd-card-price', /* Maker */ '.product-form--price', /* Lusion */ '.subtotal-price', /* Kalles */ '.cart_tot_price,.ch_tt_price,.cart_price', /* Starter theme */ '#comparePrice', /* Alamp */ '.enj-product-price,.product-total-cart,.product-total,.amount', /* Woodstock */ '.hidePrice', /* Effortless */ '.price-cart', /* Creative Monster */ '.cart-item-price,.cart-item-total', /* Dawn */ '.totals__subtotal-value,.price--end,.price--end > div:not(.exemptify_clone),.wn-line-item-original-price,.wn-line-item-discounted-price,.cart-notification-product__qty-price,.total_price,.totals__total-value', /* Quick Quote */ '.quick-quote-price,.quick-quote-extended-price', /* Revolution Slider */ '.tdf-cart-item-p-p', /* Buy Button */ '.shopify-buy__product__actual-price,.shopify-buy__cart-item__price,.shopify-buy__cart__subtotal__price', '.ajaxcart__product-price', /* Bold bundles */ '.bdl-product-price,.vtl-pb-main-widget__total-discount,.vtl-pb-main-widget__total-price,.vtl-pb-main-widget__total-saving,.vtl-pb-main-widget__product-price,.vtl-pb-main-widget__product-initial-price,.exemptify_wrap>span', /* SWYM */ '.swym-price', /* Boost Commerce */ '.bc-sf-filter-product-item-regular-price,.boost-pfs-quickview-price,.boost-pfs-filter-product-item-regular-price', /* Shogun */ '.shg-product-price', /* BCPO */ '.bcpo-cart-item-price,.bcpo-cart-item-line-price,.bcpo-cart-original-total', /* Infinite Options */ '#calculated_option_total', /* Bold Options */ '.hulkapps-cart-original-total>span,.hulkapps-price,.unit_price', /* Dynamic Product Options */ /* MW Options */ '.value-price', '.price-notice', /* Geolizr */ '.geolizr-currency', /* Dummy */ '#dummy', /* Exemptify */ '.exemptify_price,.exemptify_descend span', /* Showcase */ '.showcase-grid,.showcase-grid-item,.showcase-grid-items,.theme-money', /* Saso Cart*/ '.saso-cart-item-price,.saso-cart-item-line-price,.saso-cart-original-total', /* BC Filter */ '.bc-sf-product-regular-price', /* Recharge */ '.rc_price_onetime,.rc_price', /* Upsell */ '.rk-widget-card-price-money,.upsell-price-value,.ak-upsell-original-price,.lb-upsell-money, .lb-upsell-money > b', /* Wiser Product Recommendations */ '.ws-card__price', /* pagefly */ '.sc-pcLzI,[data-pf-type=ProductPrice]', /* EcomSolid */ '.total_price_product,.number_total', /* Boost PFS */ '.boost-pfs-search-suggestion-product-regular-price', /* Boost */ '.theme_money', /* Wholesale Discount App */ '.wn-discounted-subtotal,.wn-original-subtotal,.wcp-cart-total,.wcp-original-cart-total', /* Rebuy */ '.rebuy-money,.rebuy-cart__flyout-subtotal-amount', /* Bundle Bear */ '.ComparePrice', /* etrans */ '.etrans-money', /* Options calculator */ '.inlinePrice', /* Other */ '.pn-price-item,.pn-total-line-item,.kuSalePrice,#rrpPrice,.vtl-product-card__price,.product-price__price,.CartItem__Discount,.transcy-money,.sale-tag,.product-card__regular-price,.product-card__price,#revy-cart-subtotal-price,.ufe-cart-total-price,.checkout-price,.mbc-bundle__compare-price,.mbc-bundle__item-price > span, span[data-cart-item-regular-price] > span > s, dd[data-cart-item-regular-price] > span > s, span.cart-subtotal__price > span > s,.wishlist-hero-price-update,.spicegems-addon-price,.spicegems-main-price,.grid-product__price--from,.cbb-currency,span[data-unit-price],[data-subtotal],[data-product-price],[data-compare-price]:not(.hidden),.tdf-cart-item-lp-p,[bss-b2b-product-price],.csapps-cart-original-total > span,.csapps-cart-original-total,[data-product-type=price],.ufe-cart-item-total-price,[bss-b2b-current-variant-price],.selectedOpt,.priceProduct,.cartSubtotal,.product-price--compare,.ocu-totals__has,sale-price,.ymq-b2b-price-hidden,.items_subtotal,.ht-money,.price__was,.samitaWS-customized-price,.samitaWS-customized-original-price,.product-item__price-main>span,.cart__form-item-price' ]; var sel = selArr.join(); window.exemptify_price_classes = sel; function checkAuth() { //console.log(getCookie()); if(is_updating) return; if(!getCookie()) m4uRequest(m4u_url+'exemptify_v1.php','POST',{'action' : 'check_auth','shop':'trauth-design-gastrowear.myshopify.com'}); else walkElems(); reconnectMutationHandler(); } function m4uRequest(path,method,vals) { vals['shop'] = 'trauth-design-gastrowear.myshopify.com'; vals['time'] = '1733348072'; vals['hmac'] = '3483347d556d7663d5790b0fb6e5db3026547d108967dfe0e83b251cc0710272'; $.ajax({ url : path, type : method, crossDomain: true, data : vals, dataType:'json', success : function(data) { if( typeof data == 'string') { console.log('UNAUTHORIZED');console.log(error); return false; } setCookie(); walkElems(); }, error : function(request,error) { console.log('UNAUTHORIZED');console.log(error); //$(sel).show(); } }); } function walkElems() { console.log('Exemptify triggered'); fixSup(); iterateContainerNodes(); } window.ExemptifyTriggerUpdate = function() { checkAuth(); }; function fixSup() { var e = $('span[aria-hidden="true"] > sup,small[aria-hidden="true"] > sup'); e.each(function(){ var t = $(this).text(); $(this).replaceWith('.'+t); }); $('span[aria-hidden="true"] > sup').replaceWith('.'+e.text()); } function fixPrice(node) { var txt = formatter.formatPriceDisplay(node); $(node.parentNode).next().html(txt); } function iterateContainerNodes() { is_updating = true; var nodes_processed = {}; var j=0; var start = Date.now(); $(sel).each(function(){ if( $(this).hasClass('exemptify_ignore') ) return; var n = $(this).get(); for(var i=0;i=0) return; $(price_node).hide(); $(price_node).attr('style', 'display:none !important'); if($(price_node).parents('option').length==1) $(clone).remove(); return node; } function htmlentities(str) { str = str.replace('ö', 'ö'); str = str.replace('Ö', 'Ö'); str = str.replace('ä', 'ä'); str = str.replace('Ä', 'Ä'); str = str.replace('ü', 'ü'); str = str.replace('Ü', 'Ü'); return str; } $(document).ready(function(){ var oembed = $('link[type="application/json+oembed"]'); var embedded_offers = $('script[type="application/ld+json"]'); if(embedded_offers.length>0) { if(oembed.length>0) { oembed.remove(); oembed = $('link[type="application/json+oembed"]'); } extractMetaJSON(embedded_offers); } oembed.each(function(){ var oembed_url = $(this).attr('href'); //var new_meta = $(''); var new_meta = document.createElement('script'); new_meta.setAttribute('type', 'application/ld+json'); new_meta.setAttribute('class', 'exemptify_processed'); // document.head.appendChild(script); fetch(oembed_url) .then( (response) => ( response.json() ) ) .then( (json) => { json_string = JSON.stringify(json); new_meta.append(document.createTextNode(json_string)); $('head').append(new_meta); extractMetaJSON(new_meta); //console.log(oembed_url); } ); }); oembed.remove(); document.dispatchEvent(ev); document.addEventListener('theme:loading:end',function(){ window.ExemptifyTriggerUpdate(); }); document.documentElement.addEventListener('cart:refresh',function(){ window.ExemptifyTriggerUpdate(); }); $('section[data-section-id="product-template"]').on('variant:changed',function(){ window.ExemptifyTriggerUpdate(); }); if(!passive_mode) { if(init_delay>0) setTimeout(function(){checkAuth();},init_delay); else checkAuth(); reconnectMutationHandler(); } $('a.quick-buy,a.sca-qv-button,#addToCartText-product-template').click(function() { checkAuth(); }); }); }; if ((typeof jQuery === 'undefined') || (parseFloat(jQuery.fn.jquery) < 3)) { loadScript('//modules4u.biz/shopify/js/jquery/jquery-3.2.1.min.js', function() { jQuery32 = jQuery.noConflict(true); fix(jQuery32); } ); } else { fix(jQuery); }})();