Skip to content

Commit bb09262

Browse files
iyutdustinparker
andauthored
Fix/issue WOOSHIP-1717 - Change priority for print notices method (#2895)
* add priority for print notices method * add changelog * fix the destination address setter on the phpunit test * edit changelog * Update changelog * ensure all of the response body variable is set * throw exception if one of the response body tax is not set * remove the true condition and use json_encode for has_nexus * use json_encode for has_nexus in throw exception * small grammar fix * changelog adjustments --------- Co-authored-by: Dustin Parker <[email protected]>
1 parent ef86dc5 commit bb09262

File tree

5 files changed

+19
-9
lines changed

5 files changed

+19
-9
lines changed

changelog.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
*** WooCommerce Tax Changelog ***
22

3+
= 3.2.2 - 2025-xx-xx =
4+
* Fix - Display TaxJar error notices only after taxes are calculated.
5+
* Tweak - Log detection of potential incorrect California tax nexus in successful TaxJar API and cached responses.
6+
37
= 3.2.1 - 2025-11-03 =
48
* Fix - Exclude shipping-related admin components when shipping functionality is disabled.
5-
* Tweak - Add logging check for incorrect California tax nexus in the TaxJar API response or cached response.
69

710
= 3.2.0 - 2025-10-14 =
811
* Fix - No tax calculated for multi-word state/counties.

classes/class-wc-connect-taxjar-integration.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1628,21 +1628,25 @@ private function check_for_incorrect_california_tax_nexus( $response_body, $cach
16281628
$log_suffix = 'in cached response.';
16291629
}
16301630

1631-
$to_state = $response_body->tax->jurisdictions->state;
1632-
$to_country = $response_body->tax->jurisdictions->country;
1633-
$has_nexus = $response_body->tax->has_nexus;
1631+
$to_state = isset( $response_body->tax->jurisdictions->state ) ? $response_body->tax->jurisdictions->state : 'not set';
1632+
$to_country = isset( $response_body->tax->jurisdictions->country ) ? $response_body->tax->jurisdictions->country : 'not set';
1633+
$has_nexus = isset( $response_body->tax->has_nexus ) ? $response_body->tax->has_nexus : null;
16341634

16351635
if ( 'CA' === $to_state && 'US' === $to_country && true === $has_nexus ) {
16361636
$this->_log(
16371637
sprintf(
1638-
'Incorrect California tax nexus detected %s (from_state: %s, to_state: %s, to_country: %s, has_nexus: %s).',
1638+
'Incorrect California tax nexus detected %1$s (from_state: %2$s, to_state: %3$s, to_country: %4$s, has_nexus: %5$s).',
16391639
$log_suffix,
16401640
$from_state ?: 'unknown',
16411641
$to_state,
16421642
$to_country,
1643-
$has_nexus ? 'true' : 'false'
1643+
json_encode( $has_nexus ),
16441644
)
16451645
);
16461646
}
1647+
1648+
if ( 'not set' === $to_state || 'not set' === $to_country || null === $has_nexus ) {
1649+
throw new Exception( sprintf( 'One or more values are not set : to_state=>%1$s, to_country=>%2$s, has_nexus=>%3$s', $to_state, $to_country, json_encode( $has_nexus ) ) );
1650+
}
16471651
}
16481652
}

readme.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,12 @@ This plugin relies on the following external services:
7070

7171
== Changelog ==
7272

73+
= 3.2.2 - 2025-xx-xx =
74+
* Fix - Display TaxJar error notices only after taxes are calculated.
75+
* Tweak - Log detection of potential incorrect California tax nexus in successful TaxJar API and cached responses.
76+
7377
= 3.2.1 - 2025-11-03 =
7478
* Fix - Exclude shipping-related admin components when shipping functionality is disabled.
75-
* Tweak - Add logging check for incorrect California tax nexus in the TaxJar API response or cached response.
7679

7780
= 3.2.0 - 2025-10-14 =
7881
* Fix - No tax calculated for multi-word state/counties.

src/StoreNotices/StoreNoticesController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class StoreNoticesController {
3434
public function __construct( StoreNoticesNotifier $notifier ) {
3535
$this->notifier = $notifier;
3636

37-
add_action( 'woocommerce_after_calculate_totals', array( $this, 'maybe_display_notices' ) );
37+
add_action( 'woocommerce_after_calculate_totals', array( $this, 'maybe_display_notices' ), 30 );
3838
add_filter( 'woocommerce_store_api_cart_errors', array( $this, 'add_store_api_cart_errors' ), 10, 2 );
3939
}
4040

tests/bin/install-wc-tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ DB_USER=$2
1010
DB_PASS=$3
1111
DB_HOST=${4-localhost}
1212
WP_VERSION=${5-latest}
13-
WC_VERSION=${6-"7.4.1"}
13+
WC_VERSION=${6-"10.3.4"}
1414

1515
export NVM_DIR="$HOME/.nvm"
1616
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm

0 commit comments

Comments
 (0)