Plugin Directory

Changeset 3361878


Ignore:
Timestamp:
09/15/2025 03:04:20 PM (6 months ago)
Author:
wijnbergdevelopments
Message:

Fixed price calculation if tax is zero for the current customer (zero tax rate country)

Location:
tax-switch-for-woocommerce
Files:
98 added
5 edited

Legend:

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

    r3348796 r3361878  
    44Requires at least: 5.0
    55Tested up to: 6.8
    6 Stable tag: 1.5.13
     6Stable tag: 1.5.14
    77Requires PHP: 7.2
    88License: GPL-2.0+
     
    233233
    234234== Changelog ==
     235= 1.5.14 =
     236* Fixed price calculation if tax is zero for the current customer (zero tax rate country)
     237
    235238= 1.5.13 =
    236239* Fixed tax calculation if product price is zero
  • tax-switch-for-woocommerce/trunk/build/label/block.json

    r3348796 r3361878  
    33  "apiVersion": 3,
    44  "name": "wdevs/tax-switch-label",
    5   "version": "1.5.13",
     5  "version": "1.5.14",
    66  "title": "Tax Switch text label",
    77  "category": "woocommerce",
  • tax-switch-for-woocommerce/trunk/build/switch/block.json

    r3348796 r3361878  
    33  "apiVersion": 3,
    44  "name": "wdevs/tax-switch",
    5   "version": "1.5.13",
     5  "version": "1.5.14",
    66  "title": "Tax Switch for WooCommerce",
    77  "category": "woocommerce",
  • tax-switch-for-woocommerce/trunk/includes/trait-wdevs-tax-switch-helper.php

    r3348796 r3361878  
    8787     *
    8888     * @param WC_Product $product
     89     *
    8990     * @return float|int
    9091     * @since 1.5.13
     
    101102        $calculator->set_price( 1.00 );
    102103
    103         // Directly calculate tax rate to avoid infinite recursion
    104104        $price_excl_tax = wc_get_price_excluding_tax( $calculator );
    105105
    106         // Prevent division by zero (should not happen with €10.00 but safety first)
     106        // Prevent division by zero (should not happen with 1.00 but safety first)
    107107        if ( $price_excl_tax <= 0 ) {
    108108            return 0;
     
    135135        } else {
    136136            $calculator->set_tax_status( 'taxable' );
     137        }
     138
     139        //If the original price doesn't have any tax. For example; country with 0 tax.
     140        $tax_rate = $this->get_product_tax_rate( $calculator );
     141        if ( $tax_rate <= 0 ) {
     142            return $price;
    137143        }
    138144
     
    273279
    274280    /**
     281     * @return array
    275282     * @since 1.5.4
    276283     *
    277      * @return array
    278284     */
    279285    public function register_script( $handle, $build_dir, $asset_name, $extra_dependencies = [] ) {
    280         $script_path = plugin_dir_url( dirname( __FILE__ ) ) . 'build/' . $build_dir . '/' . $asset_name . '.js';
    281         $script_asset = require( plugin_dir_path( dirname( __FILE__ ) ) .  'build/' . $build_dir . '/' . $asset_name .'.asset.php' );
     286        $script_path  = plugin_dir_url( dirname( __FILE__ ) ) . 'build/' . $build_dir . '/' . $asset_name . '.js';
     287        $script_asset = require( plugin_dir_path( dirname( __FILE__ ) ) . 'build/' . $build_dir . '/' . $asset_name . '.asset.php' );
    282288
    283289        wp_register_script(
     
    292298
    293299    /**
     300     * @return array
    294301     * @since 1.5.4
    295302     *
    296      * @return array
    297303     */
    298304    public function enqueue_script( $handle, $build_dir, $asset_name, $extra_dependencies = [] ) {
    299         $script_path = plugin_dir_url( dirname( __FILE__ ) ) . 'build/' . $build_dir . '/' . $asset_name . '.js';
    300         $script_asset = require( plugin_dir_path( dirname( __FILE__ ) ) .  'build/' . $build_dir . '/' . $asset_name .'.asset.php' );
     305        $script_path  = plugin_dir_url( dirname( __FILE__ ) ) . 'build/' . $build_dir . '/' . $asset_name . '.js';
     306        $script_asset = require( plugin_dir_path( dirname( __FILE__ ) ) . 'build/' . $build_dir . '/' . $asset_name . '.asset.php' );
    301307
    302308        wp_enqueue_script(
  • tax-switch-for-woocommerce/trunk/wdevs-tax-switch.php

    r3348796 r3361878  
    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.13
     19 * Version:              1.5.14
    2020 * Author:               Wijnberg Developments
    2121 * Author URI:           https://wijnberg.dev/
     
    4141 * Rename this for your plugin and update it as you release new versions.
    4242 */
    43 define( 'WDEVS_TAX_SWITCH_VERSION', '1.5.13' );
     43define( 'WDEVS_TAX_SWITCH_VERSION', '1.5.14' );
    4444
    4545/**
Note: See TracChangeset for help on using the changeset viewer.