Skip to content

Commit d7bc132

Browse files
Add support for itemized tax rates (#2862)
* Prevent empty tax rates backups * Improve backup file names * Allow to change Display tax totals option * Add itemized_taxes property and method * Add missing property declaration * Backup tax rates when switching between itemized and total taxes * Add support for itemized taxes * Add changelog entries * Add itemized tax rate name * Improve documentation for `generate_itemized_tax_rate_name` method in TaxJar integration * Refactor: Rename `itemized_taxes` to `is_tax_display_itemized` and improve method documentation in TaxJar integration --------- Co-authored-by: Dustin Parker <11618203+dustinparker@users.noreply.github.com>
1 parent 37794ab commit d7bc132

4 files changed

Lines changed: 282 additions & 47 deletions

File tree

changelog.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
*** WooCommerce Tax Changelog ***
22

3+
= 3.1.0 - 2025-xx-xx =
4+
* Add - Support for Itemized tax rates.
5+
36
= 3.0.5 - 2025-07-14 =
47
* Tweak - WooCommerce 10.0 Compatibility.
58

classes/class-wc-connect-functions.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@ public static function backup_existing_tax_rates() {
162162
)
163163
);
164164

165+
if ( empty( $rates ) ) {
166+
return false;
167+
}
168+
165169
ob_start();
166170
$header =
167171
__( 'Country Code', 'woocommerce' ) . ',' .
@@ -258,7 +262,7 @@ public static function backup_existing_tax_rates() {
258262

259263
$csv = ob_get_clean();
260264
$upload_dir = wp_upload_dir();
261-
$backed_up = file_put_contents( $upload_dir['basedir'] . '/taxjar-wc_tax_rates-' . date( 'm-d-Y' ) . '-' . time() . '.csv', $csv );
265+
$backed_up = file_put_contents( $upload_dir['basedir'] . '/taxjar-wc_tax_rates-' . date( 'Y-m-d' ) . '-' . time() . '.csv', $csv );
262266

263267
return (bool) $backed_up;
264268
}
@@ -278,7 +282,7 @@ public static function get_backed_up_tax_rate_files() {
278282
return false;
279283
}
280284

281-
$files = [];
285+
$files = array();
282286
foreach ( $found_files as $file ) {
283287
$filename = basename( $file );
284288
$files[ $filename ] = $upload_dir['baseurl'] . '/' . $filename;

0 commit comments

Comments
 (0)