Skip to content

Checking if taxes are enabled when verifying if ECE should be displayed #4420

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

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

wjrosa
Copy link
Contributor

@wjrosa wjrosa commented Jun 18, 2025

Fixes STRIPE-538

Changes proposed in this Pull Request:

This is a minor fix for an edge case when a store enabled taxes but disabled them afterwards. The value of woocommerce_tax_based_on would still exist, making the express checkout buttons hidden when falling into the tax-based logic for virtual products.

Testing instructions

  • Check out and build the develop branch on your test environment
  • Connect your Stripe account
  • Enable taxes for the store
  • Set the taxes to be based on the customer's billing address
  • Enable the express payment methods (Google Pay, Apple Pay, Link)
  • Now, disable taxes
  • As a shopper, add a virtual product to your cart (make sure the product is set to "taxable")
  • The express checkout buttons are not displayed
  • Checkout and build this branch instead (fix/check-if-taxes-are-enabled-when-checking-for-ece-display)
  • Confirm the buttons are now displayed

  • Covered with tests (or have a good reason not to test in description ☝️)
  • Tested on mobile (or does not apply)

Changelog entry

  • This Pull Request does not require a changelog entry. (Comment required below)
Changelog Entry Comment

Comment

Post merge

@wjrosa wjrosa self-assigned this Jun 18, 2025
@wjrosa wjrosa marked this pull request as ready for review June 19, 2025 00:10
@wjrosa wjrosa requested review from a team, annemirasol and daledupreez and removed request for a team June 19, 2025 00:10
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.

I believe we fixed this before in #3563, and somehow lost it during refactors. Thanks for catching and fixing.

Added a suggestion to use the WooCommerce-provided function.

@wjrosa wjrosa requested a review from annemirasol June 23, 2025 12:02
Copy link

📈 PHP Unit Code Coverage Report

Package Line Rate Health
includes/payment-methods/class-wc-stripe-express-checkout-helper.php 22%
Summary 44% (7164 / 16356)

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.

I think we should set $taxes_enabled to true in the unit tests, except for the two cases that specifically test for the "taxes are disabled" scenario. That way, we know the behavior is due to the scenario it is testing, and not only because taxes are enabled/or disabled, e.g. ECE should always be available in the Pay for Order page.

@wjrosa wjrosa requested a review from annemirasol June 23, 2025 18:10
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.

LGTM, thanks for fixing!

Just realized I was the one who removed the check when I added per-product tax logic 🙈

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.

2 participants