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

Display a notice if taxes vary by customer's shipping address #3550

Merged
merged 12 commits into from
Nov 4, 2024

Conversation

wjrosa
Copy link
Contributor

@wjrosa wjrosa commented Oct 25, 2024

Fixes #3521

Changes proposed in this Pull Request:

This PR adds a new notice to the Express Checkout Element informing customers when rates may differ due to taxes being based on their billing address.

The notice will be shown, and the checkout process will be delayed for 700ms. Reasons for that:

  • We cannot display an alert message because it blocks the default ECE process
  • The delay cannot be higher than 1s due to Stripe JS limitations (it times out after 1s)

Testing instructions

  • Checkout and build this branch on your test environment (fix/display-notice-when-taxes-may-differ-on-ece)
  • Enable ECE. You can do this by hardcoding is_stripe_ece_enabled to true
  • As a merchant, connect your Stripe account
  • Enable the Express Checkout methods (Link, Google Pay, Apple Pay)
  • Enable tax rates and calculations (wp-admin/admin.php?page=wc-settings&tab=general)
  • Set taxes based on the customer's shipping address (wp-admin/admin.php?page=wc-settings&tab=tax)
  • Add some shipping zones
  • As a shopper, try to purchase any physical product by any means
  • Confirm that you can complete the process without seeing the notice
  • Set taxes based on the customer's billing address (wp-admin/admin.php?page=wc-settings&tab=tax)
  • Repeat the checkout process
  • Confirm that now you can see the new notice:
Screenshot 2024-10-25 at 22 37 08
  • Covered with tests (or have a good reason not to test in description ☝️)
  • Added changelog entry in both changelog.txt and readme.txt (or does not apply)
  • Tested on mobile (or does not apply)

Post merge

@wjrosa wjrosa self-assigned this Oct 25, 2024
@wjrosa wjrosa changed the title Display a notice when taxes may differ due being based on shipping address Display a notice if taxes vary by customer's shipping address Oct 25, 2024
@wjrosa wjrosa marked this pull request as ready for review October 25, 2024 23:26
@wjrosa wjrosa requested review from a team and annemirasol and removed request for a team October 26, 2024 01:37
@annemirasol
Copy link
Contributor

@wjrosa Thanks for working on this!

✅ I see the notice for product and shortcode checkout.
❌ I don't see the notice for block checkout and block cart.

I set my taxes to be based on billing address and my ECE is enabled.

@wjrosa
Copy link
Contributor Author

wjrosa commented Oct 31, 2024

@wjrosa Thanks for working on this!

✅ I see the notice for product and shortcode checkout. ❌ I don't see the notice for block checkout and block cart.

I set my taxes to be based on billing address and my ECE is enabled.

Sorry about that, Anne! I just forgot about the block checkout and cart 🤦 . Can you check again, please?

Copy link
Contributor

@annemirasol annemirasol left a comment

Choose a reason for hiding this comment

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

Nice work! ✨ I was able to see the notice in product, block/shortcode cart, block/shortcode checkout when taxes are based on billing. No notices when it is not. Also did not observe any regression in the purchase process.

I added a suggestion to add wc_tax_enabled() in the flag logic, as taxes can be disabled even when there is a legitimate value in the woocommerce_tax_based_on option.

changelog.txt Outdated Show resolved Hide resolved
client/blocks/express-checkout/hooks.js Outdated Show resolved Hide resolved
@wjrosa wjrosa merged commit b3731e2 into develop Nov 4, 2024
34 of 35 checks passed
@wjrosa wjrosa deleted the fix/display-notice-when-taxes-may-differ-on-ece branch November 4, 2024 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ECE] Display tax related message
2 participants