Plugin Directory

Changeset 3379470


Ignore:
Timestamp:
10/16/2025 12:49:47 PM (6 months ago)
Author:
thegeneration
Message:

Tagging version 3.3.6

Location:
svea-checkout-for-woocommerce
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • svea-checkout-for-woocommerce/tags/3.3.6/inc/Models/Svea_Item.php

    r3320402 r3379470  
    33
    44use Svea_Checkout_For_Woocommerce\WC_Shipping_Svea_Nshift;
     5use WC_Tax;
    56
    67if ( ! defined( 'ABSPATH' ) ) {
     
    274275        // Prevent division by 0
    275276        if ( $cart_item['line_subtotal'] > 0 ) {
    276             $tax_percentage = round( ( $cart_item['line_subtotal_tax'] / $cart_item['line_subtotal'] ) * 100 );
     277            $tax_rates = WC_Tax::get_rates( $cart_item['data']->get_tax_class() );
     278            // Use array_reduce to calculate the combined tax percentage for multiple tax rates if used
     279            $tax_percentage = array_reduce( wp_list_pluck( $tax_rates, 'rate' ), fn ( $sum, $factor ) => $sum <= 0 ? $factor : $sum * $factor, 0.0 );
    277280        }
    278281
     
    528531            'DiscountPercent'    => intval( round( $this->discount_percent * 100 ) ),
    529532            'DiscountAmount'     => intval( round( $this->discount_amount * 100 ) ),
    530             'VatPercent'         => intval( round( $this->tax_percentage ) * 100 ),
     533            'VatPercent'         => intval( round( $this->tax_percentage, 2 ) * 100 ),
    531534            'TemporaryReference' => $this->temporary_reference,
    532535            'RowType'            => $this->row_type,
  • svea-checkout-for-woocommerce/tags/3.3.6/readme.txt

    r3359045 r3379470  
    1010License: Apache 2.0
    1111License URI: https://www.apache.org/licenses/LICENSE-2.0
    12 Stable tag: 3.3.5
     12Stable tag: 3.3.6
    1313
    1414Supercharge your WooCommerce Store with powerful features to pay via Svea Checkout!
     
    9191== Upgrade Notice ==
    9292
     93= 3.3.6 =
     943.3.6 is a patch release
     95
    9396= 3.3.5 =
    94973.3.5 is a patch release
     
    399402
    400403== Changelog ==
     404
     405= 3.3.6 2025-10-16 =
     406- Better precision when calculating tax with decimals
    401407
    402408= 3.3.5 2025-09-10 =
  • svea-checkout-for-woocommerce/tags/3.3.6/svea-checkout-for-woocommerce.php

    r3359045 r3379470  
    1414 * Plugin URI: https://wordpress.org/plugins/svea-checkout-for-woocommerce/
    1515 * Description: Process payments in WooCommerce via Svea Checkout.
    16  * Version: 3.3.5
     16 * Version: 3.3.6
    1717 * Requires Plugins: woocommerce
    1818 * Author: The Generation AB
     
    4747         * Version of plugin
    4848         */
    49         const VERSION = '3.3.5';
     49        const VERSION = '3.3.6';
    5050
    5151        /**
  • svea-checkout-for-woocommerce/trunk/inc/Models/Svea_Item.php

    r3320402 r3379470  
    33
    44use Svea_Checkout_For_Woocommerce\WC_Shipping_Svea_Nshift;
     5use WC_Tax;
    56
    67if ( ! defined( 'ABSPATH' ) ) {
     
    274275        // Prevent division by 0
    275276        if ( $cart_item['line_subtotal'] > 0 ) {
    276             $tax_percentage = round( ( $cart_item['line_subtotal_tax'] / $cart_item['line_subtotal'] ) * 100 );
     277            $tax_rates = WC_Tax::get_rates( $cart_item['data']->get_tax_class() );
     278            // Use array_reduce to calculate the combined tax percentage for multiple tax rates if used
     279            $tax_percentage = array_reduce( wp_list_pluck( $tax_rates, 'rate' ), fn ( $sum, $factor ) => $sum <= 0 ? $factor : $sum * $factor, 0.0 );
    277280        }
    278281
     
    528531            'DiscountPercent'    => intval( round( $this->discount_percent * 100 ) ),
    529532            'DiscountAmount'     => intval( round( $this->discount_amount * 100 ) ),
    530             'VatPercent'         => intval( round( $this->tax_percentage ) * 100 ),
     533            'VatPercent'         => intval( round( $this->tax_percentage, 2 ) * 100 ),
    531534            'TemporaryReference' => $this->temporary_reference,
    532535            'RowType'            => $this->row_type,
  • svea-checkout-for-woocommerce/trunk/readme.txt

    r3359045 r3379470  
    1010License: Apache 2.0
    1111License URI: https://www.apache.org/licenses/LICENSE-2.0
    12 Stable tag: 3.3.5
     12Stable tag: 3.3.6
    1313
    1414Supercharge your WooCommerce Store with powerful features to pay via Svea Checkout!
     
    9191== Upgrade Notice ==
    9292
     93= 3.3.6 =
     943.3.6 is a patch release
     95
    9396= 3.3.5 =
    94973.3.5 is a patch release
     
    399402
    400403== Changelog ==
     404
     405= 3.3.6 2025-10-16 =
     406- Better precision when calculating tax with decimals
    401407
    402408= 3.3.5 2025-09-10 =
  • svea-checkout-for-woocommerce/trunk/svea-checkout-for-woocommerce.php

    r3359045 r3379470  
    1414 * Plugin URI: https://wordpress.org/plugins/svea-checkout-for-woocommerce/
    1515 * Description: Process payments in WooCommerce via Svea Checkout.
    16  * Version: 3.3.5
     16 * Version: 3.3.6
    1717 * Requires Plugins: woocommerce
    1818 * Author: The Generation AB
     
    4747         * Version of plugin
    4848         */
    49         const VERSION = '3.3.5';
     49        const VERSION = '3.3.6';
    5050
    5151        /**
Note: See TracChangeset for help on using the changeset viewer.