woocommerce / woocommerce-gateway-stripe

The official Stripe Payment Gateway for WooCommerce
https://wordpress.org/plugins/woocommerce-gateway-stripe/
236 stars 206 forks source link

Disable ECE for incompatible tax scenarios #3493

Closed annemirasol closed 1 month ago

annemirasol commented 1 month ago

Part of #3472

Changes proposed in this Pull Request:

When the cart contains a virtual product and taxes are computed based on customer shipping or billing address, we are unable to display the correct tax computation in the ECE modal. This is because the address attached to the ECE card is not available to us until the payment is submitted.

For these cases, instead of presenting a possibly incorrect total to the customer, we are opting to hide ECE instead, similar to the WooPayments approach.

Testing instructions

  1. Make sure ECE is enabled.
    • add _wcstripe_feature_ece with a value of yes to wp_options
  2. Make sure Apple Pay/Google Pay is enabled as payment methods.
  3. Turn on Enable tax rates and calculations in WooCommerce > Settings > General.
  4. Set up taxes in WooCommerce > Settings > Tax
    • No, I will enter prices exclusive of tax
    • Calculate tax based on: Customer shipping address or Customer billing address
  5. As a shopper, add a virtual product, e.g. "Album", to your cart.
  6. Verify that express checkout does NOT appear in the cart and checkout pages.
  7. Add a shippable product to your cart.
  8. Verify that express checkout reappears in the cart and checkout pages.
  9. Remove the shippable product from your cart.
  10. Change "Calculate tax based on" to Shop base address.
  11. Verify that express checkout still appears in the cart and checkout pages.

Post merge

annemirasol commented 3 weeks ago

When taxes are based on shipping address but the cart/product is virtual, taxes get based on billing address -- something we will not have access to until the payment sheet is submitted.

Adding this note here as I was revisiting ECE and taxes and wondered why have included logic for virtual products with shipping-based tax setup.