Plugin Directory

Changeset 3370439


Ignore:
Timestamp:
09/30/2025 12:53:24 PM (3 months ago)
Author:
wijnbergdevelopments
Message:
  • Tested WooCommerce 10.2.2
  • Improved compatibility for Measurement Price Calculator for WooCommerce
Location:
tax-switch-for-woocommerce
Files:
98 added
6 edited

Legend:

Unmodified
Added
Removed
  • tax-switch-for-woocommerce/trunk/README.txt

    r3367825 r3370439  
    44Requires at least: 5.0
    55Tested up to: 6.8
    6 Stable tag: 1.5.16
     6Stable tag: 1.5.17
    77Requires PHP: 7.2
    88License: GPL-2.0+
     
    233233
    234234== Changelog ==
     235= 1.5.17 =
     236* Tested WooCommerce 10.2.2
     237* Improved compatibility for Measurement Price Calculator for WooCommerce
     238
    235239= 1.5.16 =
    236 - Improved compatibility for Measurement Price Calculator for WooCommerce
     240* Improved compatibility for Measurement Price Calculator for WooCommerce
    237241
    238242= 1.5.15 =
  • tax-switch-for-woocommerce/trunk/build/label/block.json

    r3367825 r3370439  
    33  "apiVersion": 3,
    44  "name": "wdevs/tax-switch-label",
    5   "version": "1.5.16",
     5  "version": "1.5.17",
    66  "title": "Tax Switch text label",
    77  "category": "woocommerce",
  • tax-switch-for-woocommerce/trunk/build/switch/block.json

    r3367825 r3370439  
    33  "apiVersion": 3,
    44  "name": "wdevs/tax-switch",
    5   "version": "1.5.16",
     5  "version": "1.5.17",
    66  "title": "Tax Switch for WooCommerce",
    77  "category": "woocommerce",
  • tax-switch-for-woocommerce/trunk/build/switch/woocommerce-measurement-price-calculator.asset.php

    r3367825 r3370439  
    1 <?php return array('dependencies' => array('jquery', 'wp-data'), 'version' => 'b6d912d9555198d657d4');
     1<?php return array('dependencies' => array('jquery', 'wp-data'), 'version' => 'aa36d3c663a4afe3a530');
  • tax-switch-for-woocommerce/trunk/build/switch/woocommerce-measurement-price-calculator.js

    r3367825 r3370439  
    1 (()=>{"use strict";var e,t={143:e=>{e.exports=window.wp.data},741:(e,t,r)=>{var a=r(159),i=r(651);const c=window.jQuery;var n=r.n(c),o=r(143);const s=class{constructor(e,t){this.isSwitched=!1,this.unsubscribe=null,this.originalTaxDisplay=e,this.taxRate=t,this.currentVariation=null,this.taxSwitchElementBuilder=new i.A(this.originalTaxDisplay)}init(){const e=this;e.unsubscribe=(0,o.subscribe)((()=>{const t=(0,o.select)("wdevs-tax-switch/store").getIsSwitched();e.isSwitched!==t&&(e.isSwitched=t,e.handleSwitchChange())})),e.registerWooCommerceEvents(),e.registerWCMeasurementEvents()}registerWooCommerceEvents(){const e=this;n()(".single_variation, .single_variation_wrap").bind("show_variation",(function(t,r){setTimeout((function(){if(e.currentVariation=r,r&&r.tax_rate&&(e.taxRate=r.tax_rate),window.wc_price_calculator_params){const t=e.getCurrentPrice();window.wc_price_calculator_params.product_price=t,r.price=t,n()(".qty").trigger("change")}}),500)}))}handleSwitchChange(){if(window.wc_price_calculator_params){const e=this.getCurrentPrice();e&&(window.wc_price_calculator_params.product_price=e,n()(".qty").trigger("change"))}}registerWCMeasurementEvents(){const e=this;n()(document).on("wc-measurement-price-calculator-total-price-change",(function(t,r,a){if(r&&a){const t=r*a;e.handleTotalPriceUpdate(t)}})),n()(document).on("wc-measurement-price-calculator-quantity-total-price-change",(function(t,r,a){if(r&&a){const t=r*a;e.handleTotalPriceUpdate(t)}}))}handleTotalPriceUpdate(e){if(!e||!this.taxRate)return;const t=a.A.calculateAlternatePrice(e,this.originalTaxDisplay,this.taxRate),r=this.woocommerce_price(e),i=this.woocommerce_price(t);this.replaceTotalPriceDisplay(r,i)}replaceTotalPriceDisplay(e,t){const r=n()(".total_price");if(r.length){const i=a.A.displayIncludingVat(this.originalTaxDisplay),c=this.taxSwitchElementBuilder.build(i,e,t);r.html(c)}}getCurrentPrice(){return this.currentVariation&&this.currentVariation.price_incl_vat&&this.currentVariation.price_excl_vat?a.A.displayIncludingVat(this.originalTaxDisplay)?parseFloat(this.currentVariation.price_incl_vat):parseFloat(this.currentVariation.price_excl_vat):null}cleanup(){this.unsubscribe&&this.unsubscribe()}woocommerce_price(e){let t="";const r=window.wc_price_calculator_params.woocommerce_price_num_decimals,a=window.wc_price_calculator_params.woocommerce_currency_pos,i=window.wc_price_calculator_params.woocommerce_currency_symbol;switch(e=this.number_format(e,r,window.wc_price_calculator_params.woocommerce_price_decimal_sep,window.wc_price_calculator_params.woocommerce_price_thousand_sep),"yes"===window.wc_price_calculator_params.woocommerce_price_trim_zeros&&r>0&&(e=this.woocommerce_trim_zeros(e)),a){case"left":t='<span class="amount">'+i+e+"</span>";break;case"right":t='<span class="amount">'+e+i+"</span>";break;case"left_space":t='<span class="amount">'+i+"&nbsp;"+e+"</span>";break;case"right_space":t='<span class="amount">'+e+"&nbsp;"+i+"</span>"}return t}woocommerce_trim_zeros(e){return e.replace(new RegExp(this.preg_quote(window.wc_price_calculator_params.woocommerce_price_decimal_sep,"/")+"0+$"),"")}number_format(e,t,r,a){e=(e+"").replace(/[^0-9+\-Ee.]/g,"");const i=isFinite(+e)?+e:0,c=isFinite(+t)?Math.abs(t):0,n=void 0===a?",":a,o=void 0===r?".":r;let s="";return s=new BigNumber(i).toFixed(c).split("."),s[0].length>3&&(s[0]=s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,n)),(s[1]||"").length<c&&(s[1]=s[1]||"",s[1]+=new Array(c-s[1].length+1).join("0")),s.join(o)}preg_quote(e,t){return(e+"").replace(new RegExp("[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\\\"+(t||"")+"-]","g"),"\\$&")}};window.addEventListener("DOMContentLoaded",(()=>{const e=window.wtsViewObject||{originalTaxDisplay:"incl"},t=window.wtsCompatibilityObject||{baseTaxRate:0};new s(e.originalTaxDisplay,t.baseTaxRate).init()}))}},r={};function a(e){var i=r[e];if(void 0!==i)return i.exports;var c=r[e]={exports:{}};return t[e](c,c.exports,a),c.exports}a.m=t,e=[],a.O=(t,r,i,c)=>{if(!r){var n=1/0;for(p=0;p<e.length;p++){for(var[r,i,c]=e[p],o=!0,s=0;s<r.length;s++)(!1&c||n>=c)&&Object.keys(a.O).every((e=>a.O[e](r[s])))?r.splice(s--,1):(o=!1,c<n&&(n=c));if(o){e.splice(p--,1);var l=i();void 0!==l&&(t=l)}}return t}c=c||0;for(var p=e.length;p>0&&e[p-1][2]>c;p--)e[p]=e[p-1];e[p]=[r,i,c]},a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.j=902,(()=>{var e={902:0};a.O.j=t=>0===e[t];var t=(t,r)=>{var i,c,[n,o,s]=r,l=0;if(n.some((t=>0!==e[t]))){for(i in o)a.o(o,i)&&(a.m[i]=o[i]);if(s)var p=s(a)}for(t&&t(r);l<n.length;l++)c=n[l],a.o(e,c)&&e[c]&&e[c][0](),e[c]=0;return a.O(p)},r=globalThis.webpackChunkwdevs_tax_switch=globalThis.webpackChunkwdevs_tax_switch||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var i=a.O(void 0,[320],(()=>a(741)));i=a.O(i)})();
     1(()=>{"use strict";var e,t={143:e=>{e.exports=window.wp.data},741:(e,t,r)=>{var i=r(159),a=r(651);const c=window.jQuery;var n=r.n(c),o=r(143);const s=class{constructor(e,t){this.isSwitched=!1,this.unsubscribe=null,this.originalTaxDisplay=e,this.taxRate=t,this.currentVariation=null,this.taxSwitchElementBuilder=new a.A(this.originalTaxDisplay)}init(){const e=this;e.unsubscribe=(0,o.subscribe)((()=>{const t=(0,o.select)("wdevs-tax-switch/store").getIsSwitched();e.isSwitched!==t&&(e.isSwitched=t,e.handleSwitchChange())})),e.registerWooCommerceEvents(),e.registerWCMeasurementEvents()}registerWooCommerceEvents(){const e=this;n()(".single_variation, .single_variation_wrap").bind("show_variation",(function(t,r){setTimeout((function(){if(e.currentVariation=r,r&&r.tax_rate&&(e.taxRate=r.tax_rate),window.wc_price_calculator_params){const t=e.getCurrentPrice();window.wc_price_calculator_params.product_price=t,r.price=t,n()(".qty").trigger("change")}}),500)}))}handleSwitchChange(){if(window.wc_price_calculator_params){const e=this.getCurrentPrice();e&&(window.wc_price_calculator_params.product_price=e,n()(".qty").trigger("change"))}}registerWCMeasurementEvents(){const e=this;n()(document).on("wc-measurement-price-calculator-total-price-change",(function(t,r,i){if(r&&i){const t=r*i;e.handleTotalPriceUpdate(t)}})),n()(document).on("wc-measurement-price-calculator-quantity-total-price-change",(function(t,r,i){if(r&&i){const t=r*i;e.handleTotalPriceUpdate(t)}}))}handleTotalPriceUpdate(e){if(!e||!this.taxRate)return;const t=i.A.calculateAlternatePrice(e,this.originalTaxDisplay,this.taxRate),r=this.woocommerce_price(e),a=this.woocommerce_price(t);this.replaceTotalPriceDisplay(r,a)}replaceTotalPriceDisplay(e,t){const r=n()(".total_price");if(r.length){const a=i.A.displayIncludingVat(this.originalTaxDisplay),c=this.taxSwitchElementBuilder.build(a,e,t);r.html(c)}}getCurrentPrice(){return this.currentVariation&&this.currentVariation.price_incl_vat&&this.currentVariation.price_excl_vat?"incl"===this.originalTaxDisplay?parseFloat(this.currentVariation.price_incl_vat):parseFloat(this.currentVariation.price_excl_vat):null}cleanup(){this.unsubscribe&&this.unsubscribe()}woocommerce_price(e){let t="";const r=window.wc_price_calculator_params.woocommerce_price_num_decimals,i=window.wc_price_calculator_params.woocommerce_currency_pos,a=window.wc_price_calculator_params.woocommerce_currency_symbol;switch(e=this.number_format(e,r,window.wc_price_calculator_params.woocommerce_price_decimal_sep,window.wc_price_calculator_params.woocommerce_price_thousand_sep),"yes"===window.wc_price_calculator_params.woocommerce_price_trim_zeros&&r>0&&(e=this.woocommerce_trim_zeros(e)),i){case"left":t='<span class="amount">'+a+e+"</span>";break;case"right":t='<span class="amount">'+e+a+"</span>";break;case"left_space":t='<span class="amount">'+a+"&nbsp;"+e+"</span>";break;case"right_space":t='<span class="amount">'+e+"&nbsp;"+a+"</span>"}return t}woocommerce_trim_zeros(e){return e.replace(new RegExp(this.preg_quote(window.wc_price_calculator_params.woocommerce_price_decimal_sep,"/")+"0+$"),"")}number_format(e,t,r,i){e=(e+"").replace(/[^0-9+\-Ee.]/g,"");const a=isFinite(+e)?+e:0,c=isFinite(+t)?Math.abs(t):0,n=void 0===i?",":i,o=void 0===r?".":r;let s="";return s=new BigNumber(a).toFixed(c).split("."),s[0].length>3&&(s[0]=s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,n)),(s[1]||"").length<c&&(s[1]=s[1]||"",s[1]+=new Array(c-s[1].length+1).join("0")),s.join(o)}preg_quote(e,t){return(e+"").replace(new RegExp("[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\\\"+(t||"")+"-]","g"),"\\$&")}};window.addEventListener("DOMContentLoaded",(()=>{const e=window.wtsViewObject||{originalTaxDisplay:"incl"},t=window.wtsCompatibilityObject||{baseTaxRate:0};new s(e.originalTaxDisplay,t.baseTaxRate).init()}))}},r={};function i(e){var a=r[e];if(void 0!==a)return a.exports;var c=r[e]={exports:{}};return t[e](c,c.exports,i),c.exports}i.m=t,e=[],i.O=(t,r,a,c)=>{if(!r){var n=1/0;for(p=0;p<e.length;p++){for(var[r,a,c]=e[p],o=!0,s=0;s<r.length;s++)(!1&c||n>=c)&&Object.keys(i.O).every((e=>i.O[e](r[s])))?r.splice(s--,1):(o=!1,c<n&&(n=c));if(o){e.splice(p--,1);var l=a();void 0!==l&&(t=l)}}return t}c=c||0;for(var p=e.length;p>0&&e[p-1][2]>c;p--)e[p]=e[p-1];e[p]=[r,a,c]},i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.j=902,(()=>{var e={902:0};i.O.j=t=>0===e[t];var t=(t,r)=>{var a,c,[n,o,s]=r,l=0;if(n.some((t=>0!==e[t]))){for(a in o)i.o(o,a)&&(i.m[a]=o[a]);if(s)var p=s(i)}for(t&&t(r);l<n.length;l++)c=n[l],i.o(e,c)&&e[c]&&e[c][0](),e[c]=0;return i.O(p)},r=globalThis.webpackChunkwdevs_tax_switch=globalThis.webpackChunkwdevs_tax_switch||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var a=i.O(void 0,[320],(()=>i(741)));a=i.O(a)})();
  • tax-switch-for-woocommerce/trunk/wdevs-tax-switch.php

    r3367825 r3370439  
    1717 * Plugin URI:           https://wijnberg.dev
    1818 * Description:          Let customers toggle between inclusive and exclusive VAT pricing in your WooCommerce store.
    19  * Version:              1.5.16
     19 * Version:              1.5.17
    2020 * Author:               Wijnberg Developments
    2121 * Author URI:           https://wijnberg.dev/
     
    2727 * Requires at least:    5.0
    2828 * WC requires at least: 7.0.0
    29  * WC tested up to:      10.1.0
     29 * WC tested up to:      10.2.2
    3030 * Requires Plugins:     woocommerce
    3131 */
     
    4141 * Rename this for your plugin and update it as you release new versions.
    4242 */
    43 define( 'WDEVS_TAX_SWITCH_VERSION', '1.5.16' );
     43define( 'WDEVS_TAX_SWITCH_VERSION', '1.5.17' );
    4444
    4545/**
Note: See TracChangeset for help on using the changeset viewer.