Changeset 3348796
- Timestamp:
- 08/22/2025 07:24:40 PM (7 months ago)
- Location:
- tax-switch-for-woocommerce
- Files:
-
- 198 added
- 7 edited
-
tags/1.5.12 (added)
-
tags/1.5.12/LICENSE.txt (added)
-
tags/1.5.12/README.txt (added)
-
tags/1.5.12/admin (added)
-
tags/1.5.12/admin/class-wdevs-tax-switch-admin.php (added)
-
tags/1.5.12/admin/index.php (added)
-
tags/1.5.12/admin/js (added)
-
tags/1.5.12/admin/js/wdevs-tax-switch-woocommerce.js (added)
-
tags/1.5.12/admin/partials (added)
-
tags/1.5.12/admin/partials/section-wdevs-tax-switch-shortcode.php (added)
-
tags/1.5.12/build (added)
-
tags/1.5.12/build/label (added)
-
tags/1.5.12/build/label/block.json (added)
-
tags/1.5.12/build/label/index-rtl.css (added)
-
tags/1.5.12/build/label/index.asset.php (added)
-
tags/1.5.12/build/label/index.css (added)
-
tags/1.5.12/build/label/index.js (added)
-
tags/1.5.12/build/label/style-index-rtl.css (added)
-
tags/1.5.12/build/label/style-index.css (added)
-
tags/1.5.12/build/label/view.asset.php (added)
-
tags/1.5.12/build/label/view.js (added)
-
tags/1.5.12/build/shared (added)
-
tags/1.5.12/build/shared/shared.asset.php (added)
-
tags/1.5.12/build/shared/shared.js (added)
-
tags/1.5.12/build/switch (added)
-
tags/1.5.12/build/switch/advanced-product-fields-for-woocommerce.asset.php (added)
-
tags/1.5.12/build/switch/advanced-product-fields-for-woocommerce.js (added)
-
tags/1.5.12/build/switch/block.json (added)
-
tags/1.5.12/build/switch/fibofilters.asset.php (added)
-
tags/1.5.12/build/switch/fibofilters.js (added)
-
tags/1.5.12/build/switch/index-rtl.css (added)
-
tags/1.5.12/build/switch/index.asset.php (added)
-
tags/1.5.12/build/switch/index.css (added)
-
tags/1.5.12/build/switch/index.js (added)
-
tags/1.5.12/build/switch/kapee-theme.asset.php (added)
-
tags/1.5.12/build/switch/kapee-theme.js (added)
-
tags/1.5.12/build/switch/product-extras-for-woocommerce.asset.php (added)
-
tags/1.5.12/build/switch/product-extras-for-woocommerce.js (added)
-
tags/1.5.12/build/switch/style-index-rtl.css (added)
-
tags/1.5.12/build/switch/style-index.css (added)
-
tags/1.5.12/build/switch/view.asset.php (added)
-
tags/1.5.12/build/switch/view.js (added)
-
tags/1.5.12/build/switch/woocommerce-measurement-price-calculator.asset.php (added)
-
tags/1.5.12/build/switch/woocommerce-measurement-price-calculator.js (added)
-
tags/1.5.12/build/switch/woocommerce-product-addons.asset.php (added)
-
tags/1.5.12/build/switch/woocommerce-product-addons.js (added)
-
tags/1.5.12/build/switch/woocommerce-quantity-manager.asset.php (added)
-
tags/1.5.12/build/switch/woocommerce-quantity-manager.js (added)
-
tags/1.5.12/build/switch/woocommerce-tiered-price-table.asset.php (added)
-
tags/1.5.12/build/switch/woocommerce-tiered-price-table.js (added)
-
tags/1.5.12/build/switch/woocommerce-tm-extra-product-options.asset.php (added)
-
tags/1.5.12/build/switch/woocommerce-tm-extra-product-options.js (added)
-
tags/1.5.12/build/switch/yith-woocommerce-product-add-ons.asset.php (added)
-
tags/1.5.12/build/switch/yith-woocommerce-product-add-ons.js (added)
-
tags/1.5.12/includes (added)
-
tags/1.5.12/includes/assets (added)
-
tags/1.5.12/includes/assets/css (added)
-
tags/1.5.12/includes/assets/css/wdevs-tax-switch-shared.css (added)
-
tags/1.5.12/includes/class-wdevs-tax-switch-activator.php (added)
-
tags/1.5.12/includes/class-wdevs-tax-switch-block-label.php (added)
-
tags/1.5.12/includes/class-wdevs-tax-switch-block-shared.php (added)
-
tags/1.5.12/includes/class-wdevs-tax-switch-block-switch.php (added)
-
tags/1.5.12/includes/class-wdevs-tax-switch-block.php (added)
-
tags/1.5.12/includes/class-wdevs-tax-switch-compatibility.php (added)
-
tags/1.5.12/includes/class-wdevs-tax-switch-deactivator.php (added)
-
tags/1.5.12/includes/class-wdevs-tax-switch-loader.php (added)
-
tags/1.5.12/includes/class-wdevs-tax-switch-mini-cart-context.php (added)
-
tags/1.5.12/includes/class-wdevs-tax-switch-woocommerce.php (added)
-
tags/1.5.12/includes/class-wdevs-tax-switch.php (added)
-
tags/1.5.12/includes/index.php (added)
-
tags/1.5.12/includes/trait-wdevs-tax-switch-display.php (added)
-
tags/1.5.12/includes/trait-wdevs-tax-switch-helper.php (added)
-
tags/1.5.12/includes/trait-wdevs-tax-switch-plugins.php (added)
-
tags/1.5.12/languages (added)
-
tags/1.5.12/languages/build.json (added)
-
tags/1.5.12/languages/tax-switch-for-woocommerce-en_US-43dcd1c557291b1a502cbd2ea4d36beb.json (added)
-
tags/1.5.12/languages/tax-switch-for-woocommerce-en_US-a7d03486c29d1d1d1553c783663175ae.json (added)
-
tags/1.5.12/languages/tax-switch-for-woocommerce-en_US.l10n.php (added)
-
tags/1.5.12/languages/tax-switch-for-woocommerce-en_US.mo (added)
-
tags/1.5.12/languages/tax-switch-for-woocommerce-en_US.po (added)
-
tags/1.5.12/languages/tax-switch-for-woocommerce-nl_NL-43dcd1c557291b1a502cbd2ea4d36beb.json (added)
-
tags/1.5.12/languages/tax-switch-for-woocommerce-nl_NL-a7d03486c29d1d1d1553c783663175ae.json (added)
-
tags/1.5.12/languages/tax-switch-for-woocommerce-nl_NL.l10n.php (added)
-
tags/1.5.12/languages/tax-switch-for-woocommerce-nl_NL.mo (added)
-
tags/1.5.12/languages/tax-switch-for-woocommerce-nl_NL.po (added)
-
tags/1.5.12/languages/tax-switch-for-woocommerce-sv_SE-43dcd1c557291b1a502cbd2ea4d36beb.json (added)
-
tags/1.5.12/languages/tax-switch-for-woocommerce-sv_SE-a7d03486c29d1d1d1553c783663175ae.json (added)
-
tags/1.5.12/languages/tax-switch-for-woocommerce-sv_SE.l10n.php (added)
-
tags/1.5.12/languages/tax-switch-for-woocommerce-sv_SE.mo (added)
-
tags/1.5.12/languages/tax-switch-for-woocommerce-sv_SE.po (added)
-
tags/1.5.12/languages/tax-switch-for-woocommerce.pot (added)
-
tags/1.5.12/public (added)
-
tags/1.5.12/public/class-wdevs-tax-switch-public.php (added)
-
tags/1.5.12/public/css (added)
-
tags/1.5.12/public/css/wdevs-tax-switch-public.css (added)
-
tags/1.5.12/public/index.php (added)
-
tags/1.5.12/uninstall.php (added)
-
tags/1.5.12/wdevs-tax-switch.php (added)
-
tags/1.5.13 (added)
-
tags/1.5.13/LICENSE.txt (added)
-
tags/1.5.13/README.txt (added)
-
tags/1.5.13/admin (added)
-
tags/1.5.13/admin/class-wdevs-tax-switch-admin.php (added)
-
tags/1.5.13/admin/index.php (added)
-
tags/1.5.13/admin/js (added)
-
tags/1.5.13/admin/js/wdevs-tax-switch-woocommerce.js (added)
-
tags/1.5.13/admin/partials (added)
-
tags/1.5.13/admin/partials/section-wdevs-tax-switch-shortcode.php (added)
-
tags/1.5.13/build (added)
-
tags/1.5.13/build/label (added)
-
tags/1.5.13/build/label/block.json (added)
-
tags/1.5.13/build/label/index-rtl.css (added)
-
tags/1.5.13/build/label/index.asset.php (added)
-
tags/1.5.13/build/label/index.css (added)
-
tags/1.5.13/build/label/index.js (added)
-
tags/1.5.13/build/label/style-index-rtl.css (added)
-
tags/1.5.13/build/label/style-index.css (added)
-
tags/1.5.13/build/label/view.asset.php (added)
-
tags/1.5.13/build/label/view.js (added)
-
tags/1.5.13/build/shared (added)
-
tags/1.5.13/build/shared/shared.asset.php (added)
-
tags/1.5.13/build/shared/shared.js (added)
-
tags/1.5.13/build/switch (added)
-
tags/1.5.13/build/switch/advanced-product-fields-for-woocommerce.asset.php (added)
-
tags/1.5.13/build/switch/advanced-product-fields-for-woocommerce.js (added)
-
tags/1.5.13/build/switch/block.json (added)
-
tags/1.5.13/build/switch/fibofilters.asset.php (added)
-
tags/1.5.13/build/switch/fibofilters.js (added)
-
tags/1.5.13/build/switch/index-rtl.css (added)
-
tags/1.5.13/build/switch/index.asset.php (added)
-
tags/1.5.13/build/switch/index.css (added)
-
tags/1.5.13/build/switch/index.js (added)
-
tags/1.5.13/build/switch/kapee-theme.asset.php (added)
-
tags/1.5.13/build/switch/kapee-theme.js (added)
-
tags/1.5.13/build/switch/product-extras-for-woocommerce.asset.php (added)
-
tags/1.5.13/build/switch/product-extras-for-woocommerce.js (added)
-
tags/1.5.13/build/switch/style-index-rtl.css (added)
-
tags/1.5.13/build/switch/style-index.css (added)
-
tags/1.5.13/build/switch/view.asset.php (added)
-
tags/1.5.13/build/switch/view.js (added)
-
tags/1.5.13/build/switch/woocommerce-measurement-price-calculator.asset.php (added)
-
tags/1.5.13/build/switch/woocommerce-measurement-price-calculator.js (added)
-
tags/1.5.13/build/switch/woocommerce-product-addons.asset.php (added)
-
tags/1.5.13/build/switch/woocommerce-product-addons.js (added)
-
tags/1.5.13/build/switch/woocommerce-quantity-manager.asset.php (added)
-
tags/1.5.13/build/switch/woocommerce-quantity-manager.js (added)
-
tags/1.5.13/build/switch/woocommerce-tiered-price-table.asset.php (added)
-
tags/1.5.13/build/switch/woocommerce-tiered-price-table.js (added)
-
tags/1.5.13/build/switch/woocommerce-tm-extra-product-options.asset.php (added)
-
tags/1.5.13/build/switch/woocommerce-tm-extra-product-options.js (added)
-
tags/1.5.13/build/switch/yith-woocommerce-product-add-ons.asset.php (added)
-
tags/1.5.13/build/switch/yith-woocommerce-product-add-ons.js (added)
-
tags/1.5.13/includes (added)
-
tags/1.5.13/includes/assets (added)
-
tags/1.5.13/includes/assets/css (added)
-
tags/1.5.13/includes/assets/css/wdevs-tax-switch-shared.css (added)
-
tags/1.5.13/includes/class-wdevs-tax-switch-activator.php (added)
-
tags/1.5.13/includes/class-wdevs-tax-switch-block-label.php (added)
-
tags/1.5.13/includes/class-wdevs-tax-switch-block-shared.php (added)
-
tags/1.5.13/includes/class-wdevs-tax-switch-block-switch.php (added)
-
tags/1.5.13/includes/class-wdevs-tax-switch-block.php (added)
-
tags/1.5.13/includes/class-wdevs-tax-switch-compatibility.php (added)
-
tags/1.5.13/includes/class-wdevs-tax-switch-deactivator.php (added)
-
tags/1.5.13/includes/class-wdevs-tax-switch-loader.php (added)
-
tags/1.5.13/includes/class-wdevs-tax-switch-mini-cart-context.php (added)
-
tags/1.5.13/includes/class-wdevs-tax-switch-woocommerce.php (added)
-
tags/1.5.13/includes/class-wdevs-tax-switch.php (added)
-
tags/1.5.13/includes/index.php (added)
-
tags/1.5.13/includes/trait-wdevs-tax-switch-display.php (added)
-
tags/1.5.13/includes/trait-wdevs-tax-switch-helper.php (added)
-
tags/1.5.13/includes/trait-wdevs-tax-switch-plugins.php (added)
-
tags/1.5.13/languages (added)
-
tags/1.5.13/languages/build.json (added)
-
tags/1.5.13/languages/tax-switch-for-woocommerce-en_US-43dcd1c557291b1a502cbd2ea4d36beb.json (added)
-
tags/1.5.13/languages/tax-switch-for-woocommerce-en_US-a7d03486c29d1d1d1553c783663175ae.json (added)
-
tags/1.5.13/languages/tax-switch-for-woocommerce-en_US.l10n.php (added)
-
tags/1.5.13/languages/tax-switch-for-woocommerce-en_US.mo (added)
-
tags/1.5.13/languages/tax-switch-for-woocommerce-en_US.po (added)
-
tags/1.5.13/languages/tax-switch-for-woocommerce-nl_NL-43dcd1c557291b1a502cbd2ea4d36beb.json (added)
-
tags/1.5.13/languages/tax-switch-for-woocommerce-nl_NL-a7d03486c29d1d1d1553c783663175ae.json (added)
-
tags/1.5.13/languages/tax-switch-for-woocommerce-nl_NL.l10n.php (added)
-
tags/1.5.13/languages/tax-switch-for-woocommerce-nl_NL.mo (added)
-
tags/1.5.13/languages/tax-switch-for-woocommerce-nl_NL.po (added)
-
tags/1.5.13/languages/tax-switch-for-woocommerce-sv_SE-43dcd1c557291b1a502cbd2ea4d36beb.json (added)
-
tags/1.5.13/languages/tax-switch-for-woocommerce-sv_SE-a7d03486c29d1d1d1553c783663175ae.json (added)
-
tags/1.5.13/languages/tax-switch-for-woocommerce-sv_SE.l10n.php (added)
-
tags/1.5.13/languages/tax-switch-for-woocommerce-sv_SE.mo (added)
-
tags/1.5.13/languages/tax-switch-for-woocommerce-sv_SE.po (added)
-
tags/1.5.13/languages/tax-switch-for-woocommerce.pot (added)
-
tags/1.5.13/public (added)
-
tags/1.5.13/public/class-wdevs-tax-switch-public.php (added)
-
tags/1.5.13/public/css (added)
-
tags/1.5.13/public/css/wdevs-tax-switch-public.css (added)
-
tags/1.5.13/public/index.php (added)
-
tags/1.5.13/uninstall.php (added)
-
tags/1.5.13/wdevs-tax-switch.php (added)
-
trunk/README.txt (modified) (4 diffs)
-
trunk/build/label/block.json (modified) (1 diff)
-
trunk/build/switch/block.json (modified) (1 diff)
-
trunk/build/switch/woocommerce-tm-extra-product-options.asset.php (added)
-
trunk/build/switch/woocommerce-tm-extra-product-options.js (added)
-
trunk/includes/class-wdevs-tax-switch-compatibility.php (modified) (1 diff)
-
trunk/includes/class-wdevs-tax-switch.php (modified) (1 diff)
-
trunk/includes/trait-wdevs-tax-switch-helper.php (modified) (1 diff)
-
trunk/wdevs-tax-switch.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tax-switch-for-woocommerce/trunk/README.txt
r3336052 r3348796 4 4 Requires at least: 5.0 5 5 Tested up to: 6.8 6 Stable tag: 1.5.1 16 Stable tag: 1.5.13 7 7 Requires PHP: 7.2 8 8 License: GPL-2.0+ … … 196 196 * B2B Market 197 197 * FiboFilters 198 * Extra Product Options & Add-Ons for WooCommerce 198 199 199 200 If you encounter any compatibility issues with other plugins or themes, please let us know. Your feedback helps us improve the plugin and extend compatibility to more third-party solutions. … … 232 233 233 234 == Changelog == 235 = 1.5.13 = 236 * Fixed tax calculation if product price is zero 237 238 = 1.5.12 = 239 * Added compatibility for Extra Product Options & Add-Ons for WooCommerce 240 * Tested WooCommerce 10.1.0 241 234 242 = 1.5.11 = 235 243 * Added wp_kses_allowed_html filter to allow spans in certain contexts for price displays 236 * Added compatibility for Entr theme [See this issue](https://github.com/Paulsky/tax-switch/issues/3)244 * Added compatibility for Entr theme. [See this issue](https://github.com/Paulsky/tax-switch/issues/3) 237 245 * Improved compatibility with GeneratePress 238 246 … … 381 389 == Additional Information == 382 390 391 This plugin is fully open source. You can find the source code on [GitHub](https://github.com/Paulsky/tax-switch) 392 383 393 For more information and other WordPress plugins, visit [Wijnberg Developments](https://products.wijnberg.dev/product-category/wordpress/plugins/). 384 394 -
tax-switch-for-woocommerce/trunk/build/label/block.json
r3336052 r3348796 3 3 "apiVersion": 3, 4 4 "name": "wdevs/tax-switch-label", 5 "version": "1.5.1 1",5 "version": "1.5.13", 6 6 "title": "Tax Switch text label", 7 7 "category": "woocommerce", -
tax-switch-for-woocommerce/trunk/build/switch/block.json
r3336052 r3348796 3 3 "apiVersion": 3, 4 4 "name": "wdevs/tax-switch", 5 "version": "1.5.1 1",5 "version": "1.5.13", 6 6 "title": "Tax Switch for WooCommerce", 7 7 "category": "woocommerce", -
tax-switch-for-woocommerce/trunk/includes/class-wdevs-tax-switch-compatibility.php
r3336052 r3348796 130 130 wp_localize_script( 131 131 $kapee_handle, 132 'wtsCompatibilityObject', 133 [ 'baseTaxRate' => $tax_rate ] 134 ); 135 } 136 137 // Extra Product Options & Add-Ons for WooCommerce 138 if ( $this->is_plugin_active( 'woocommerce-tm-extra-product-options/tm-woo-extra-product-options.php' ) ) { 139 $tmtepo_handle = 'wdevs-tax-switch-woocommerce-tm-extra-product-options'; 140 $tmtepo_asset = $this->enqueue_script($tmtepo_handle, 'switch', 'woocommerce-tm-extra-product-options', [ 'themecomplete-epo' ]); 141 142 wp_localize_script( 143 $tmtepo_handle, 132 144 'wtsCompatibilityObject', 133 145 [ 'baseTaxRate' => $tax_rate ] -
tax-switch-for-woocommerce/trunk/includes/class-wdevs-tax-switch.php
r3336052 r3348796 296 296 } 297 297 298 // Check for YITH WooCommerce Product Add-Ons (both free and premium versions) 299 // and for Woocommerce Quantity Manager298 // Check for YITH WooCommerce Product Add-Ons (both free and premium versions), 299 // Woocommerce Quantity Manager, and Extra Product Options & Add-Ons for WooCommerce 300 300 if ( $this->is_any_plugin_active( [ 301 301 'yith-woocommerce-product-add-ons/init.php', 302 302 'yith-woocommerce-advanced-product-options-premium/init.php', 303 'woocommerce-quantity-manager-pro/woocommerce-quantity-manager-pro.php' 303 'woocommerce-quantity-manager-pro/woocommerce-quantity-manager-pro.php', 304 'woocommerce-tm-extra-product-options/tm-woo-extra-product-options.php' 304 305 ] ) ) { 305 306 $this->loader->add_filter( -
tax-switch-for-woocommerce/trunk/includes/trait-wdevs-tax-switch-helper.php
r3300428 r3348796 69 69 $price_excl_tax = wc_get_price_excluding_tax( $product ); 70 70 71 // Prevent division by zero 71 // Prevent division by zero - use fallback for 0.00 products 72 if ( $price_excl_tax <= 0 ) { 73 return $this->get_fallback_tax_rate( $product ); 74 } 75 76 $price_incl_tax = wc_get_price_including_tax( $product ); 77 78 $tax_rate = ( ( $price_incl_tax - $price_excl_tax ) / $price_excl_tax ) * 100; 79 80 return $tax_rate; 81 //return round($tax_rate, 2); 82 } 83 84 /** 85 * Get fallback tax rate for products with €0.00 price 86 * Creates a temporary product with €1.00 price to calculate tax rate 87 * 88 * @param WC_Product $product 89 * @return float|int 90 * @since 1.5.13 91 */ 92 public function get_fallback_tax_rate( $product ) { 93 if ( ! $product ) { 94 return 0; 95 } 96 97 // Create a temporary product clone 98 $calculator = clone $product; 99 100 // Set price to 1.00 to avoid division by zero 101 $calculator->set_price( 1.00 ); 102 103 // Directly calculate tax rate to avoid infinite recursion 104 $price_excl_tax = wc_get_price_excluding_tax( $calculator ); 105 106 // Prevent division by zero (should not happen with €10.00 but safety first) 72 107 if ( $price_excl_tax <= 0 ) { 73 108 return 0; 74 109 } 75 110 76 $price_incl_tax = wc_get_price_including_tax( $ product);111 $price_incl_tax = wc_get_price_including_tax( $calculator ); 77 112 78 113 $tax_rate = ( ( $price_incl_tax - $price_excl_tax ) / $price_excl_tax ) * 100; 79 114 80 115 return $tax_rate; 81 //return round($tax_rate, 2);82 116 } 83 117 -
tax-switch-for-woocommerce/trunk/wdevs-tax-switch.php
r3336052 r3348796 17 17 * Plugin URI: https://wijnberg.dev 18 18 * Description: Let customers toggle between inclusive and exclusive VAT pricing in your WooCommerce store. 19 * Version: 1.5.1 119 * Version: 1.5.13 20 20 * Author: Wijnberg Developments 21 21 * Author URI: https://wijnberg.dev/ … … 27 27 * Requires at least: 5.0 28 28 * WC requires at least: 7.0.0 29 * WC tested up to: 10. 0.229 * WC tested up to: 10.1.0 30 30 * Requires Plugins: woocommerce 31 31 */ … … 41 41 * Rename this for your plugin and update it as you release new versions. 42 42 */ 43 define( 'WDEVS_TAX_SWITCH_VERSION', '1.5.1 1' );43 define( 'WDEVS_TAX_SWITCH_VERSION', '1.5.13' ); 44 44 45 45 /**
Note: See TracChangeset
for help on using the changeset viewer.