Changeset 3379470
- Timestamp:
- 10/16/2025 12:49:47 PM (6 months ago)
- Location:
- svea-checkout-for-woocommerce
- Files:
-
- 6 edited
- 1 copied
-
tags/3.3.6 (copied) (copied from svea-checkout-for-woocommerce/trunk)
-
tags/3.3.6/inc/Models/Svea_Item.php (modified) (3 diffs)
-
tags/3.3.6/readme.txt (modified) (3 diffs)
-
tags/3.3.6/svea-checkout-for-woocommerce.php (modified) (2 diffs)
-
trunk/inc/Models/Svea_Item.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/svea-checkout-for-woocommerce.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
svea-checkout-for-woocommerce/tags/3.3.6/inc/Models/Svea_Item.php
r3320402 r3379470 3 3 4 4 use Svea_Checkout_For_Woocommerce\WC_Shipping_Svea_Nshift; 5 use WC_Tax; 5 6 6 7 if ( ! defined( 'ABSPATH' ) ) { … … 274 275 // Prevent division by 0 275 276 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 ); 277 280 } 278 281 … … 528 531 'DiscountPercent' => intval( round( $this->discount_percent * 100 ) ), 529 532 'DiscountAmount' => intval( round( $this->discount_amount * 100 ) ), 530 'VatPercent' => intval( round( $this->tax_percentage ) * 100 ),533 'VatPercent' => intval( round( $this->tax_percentage, 2 ) * 100 ), 531 534 'TemporaryReference' => $this->temporary_reference, 532 535 'RowType' => $this->row_type, -
svea-checkout-for-woocommerce/tags/3.3.6/readme.txt
r3359045 r3379470 10 10 License: Apache 2.0 11 11 License URI: https://www.apache.org/licenses/LICENSE-2.0 12 Stable tag: 3.3. 512 Stable tag: 3.3.6 13 13 14 14 Supercharge your WooCommerce Store with powerful features to pay via Svea Checkout! … … 91 91 == Upgrade Notice == 92 92 93 = 3.3.6 = 94 3.3.6 is a patch release 95 93 96 = 3.3.5 = 94 97 3.3.5 is a patch release … … 399 402 400 403 == Changelog == 404 405 = 3.3.6 2025-10-16 = 406 - Better precision when calculating tax with decimals 401 407 402 408 = 3.3.5 2025-09-10 = -
svea-checkout-for-woocommerce/tags/3.3.6/svea-checkout-for-woocommerce.php
r3359045 r3379470 14 14 * Plugin URI: https://wordpress.org/plugins/svea-checkout-for-woocommerce/ 15 15 * Description: Process payments in WooCommerce via Svea Checkout. 16 * Version: 3.3. 516 * Version: 3.3.6 17 17 * Requires Plugins: woocommerce 18 18 * Author: The Generation AB … … 47 47 * Version of plugin 48 48 */ 49 const VERSION = '3.3. 5';49 const VERSION = '3.3.6'; 50 50 51 51 /** -
svea-checkout-for-woocommerce/trunk/inc/Models/Svea_Item.php
r3320402 r3379470 3 3 4 4 use Svea_Checkout_For_Woocommerce\WC_Shipping_Svea_Nshift; 5 use WC_Tax; 5 6 6 7 if ( ! defined( 'ABSPATH' ) ) { … … 274 275 // Prevent division by 0 275 276 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 ); 277 280 } 278 281 … … 528 531 'DiscountPercent' => intval( round( $this->discount_percent * 100 ) ), 529 532 'DiscountAmount' => intval( round( $this->discount_amount * 100 ) ), 530 'VatPercent' => intval( round( $this->tax_percentage ) * 100 ),533 'VatPercent' => intval( round( $this->tax_percentage, 2 ) * 100 ), 531 534 'TemporaryReference' => $this->temporary_reference, 532 535 'RowType' => $this->row_type, -
svea-checkout-for-woocommerce/trunk/readme.txt
r3359045 r3379470 10 10 License: Apache 2.0 11 11 License URI: https://www.apache.org/licenses/LICENSE-2.0 12 Stable tag: 3.3. 512 Stable tag: 3.3.6 13 13 14 14 Supercharge your WooCommerce Store with powerful features to pay via Svea Checkout! … … 91 91 == Upgrade Notice == 92 92 93 = 3.3.6 = 94 3.3.6 is a patch release 95 93 96 = 3.3.5 = 94 97 3.3.5 is a patch release … … 399 402 400 403 == Changelog == 404 405 = 3.3.6 2025-10-16 = 406 - Better precision when calculating tax with decimals 401 407 402 408 = 3.3.5 2025-09-10 = -
svea-checkout-for-woocommerce/trunk/svea-checkout-for-woocommerce.php
r3359045 r3379470 14 14 * Plugin URI: https://wordpress.org/plugins/svea-checkout-for-woocommerce/ 15 15 * Description: Process payments in WooCommerce via Svea Checkout. 16 * Version: 3.3. 516 * Version: 3.3.6 17 17 * Requires Plugins: woocommerce 18 18 * Author: The Generation AB … … 47 47 * Version of plugin 48 48 */ 49 const VERSION = '3.3. 5';49 const VERSION = '3.3.6'; 50 50 51 51 /**
Note: See TracChangeset
for help on using the changeset viewer.