Skip to content

Fix/issue 2833 - Display a notice to use 9 digit zip code for more accurate tax calculation#2835

Open
iyut wants to merge 11 commits intotrunkfrom
fix/issue-2833
Open

Fix/issue 2833 - Display a notice to use 9 digit zip code for more accurate tax calculation#2835
iyut wants to merge 11 commits intotrunkfrom
fix/issue-2833

Conversation

@iyut
Copy link
Copy Markdown
Collaborator

@iyut iyut commented Jan 6, 2025

Description

Displaying an error notice to let the user know that 9 digit zip code is recommended for more accurate tax calculation.

Related issue(s)

Fixes #2833

Steps to reproduce & screenshots/GIFs

  1. Add product into the cart.
  2. Go to the checkout page.
  3. Add address and input 5 digit for the zip code.
  4. The notice will appear.
  5. Input 9 digit zip code and the notice will disappear.

Checklist

  • unit tests
  • changelog.txt entry added
  • readme.txt entry added

@iyut iyut requested a review from bartech January 7, 2025 05:13
@iyut iyut marked this pull request as ready for review January 7, 2025 05:13
@iyut iyut requested a review from dustinparker January 7, 2025 05:13
@iyut iyut requested a review from Abdalsalaam January 8, 2025 09:36
@iyut iyut self-assigned this Jan 9, 2025
Copy link
Copy Markdown
Collaborator

@dustinparker dustinparker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything is looking good and works on both classic/blocks cart/checkout already. I've just left some questions/comments for potential improvements.

Comment thread changelog.txt Outdated
Comment thread changelog.txt Outdated
*
* @param string|array $message Error message.
*/
public function _notice( $message ) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for the function _ prefix?

* @param string|array $message Error message.
*/
public function _notice( $message ) {
$formatted_message = is_scalar( $message ) ? $message : wp_json_encode( $message );
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to accept scalar values for the notice message? Or should we only be accepting strings?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please review how we are using the core/notices store and the wc/checkout/shipping-address notice context to fine tune where we are adding the notice and see if we can take the same approach here instead of creating a more custom kind of notice?

Comment thread readme.txt Outdated
Comment thread readme.txt Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect tax rates return from TaxJar for Colorado

4 participants