Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 11 commits into
base: trunk
Choose a base branch
from

Conversation

iyut
Copy link
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
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.

*
* @param string|array $message Error message.
*/
public function _notice( $message ) {
Copy link
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
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
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?

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