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

Add ECE support for multiple product types #8987

Merged
merged 39 commits into from
Jul 9, 2024

Conversation

asumaran
Copy link
Contributor

@asumaran asumaran commented Jun 20, 2024

Changes proposed in this Pull Request

Closes #8871
Fixes #8981

Add support for the same product types that we currently support with PRBs.

Testing Instructions

Important

I recommend skipping the failed test cases and not wasting time reviewing them, as they fail due to limitations in ECE and PRBs. For more information, refer to issues #9020 and #8373.

Important

Due to the amount of testing cases I only tested it on Chrome with Google Pay using my own credit cards. Ensure your site is in test mode.

Important

I'd recommend clearing cookies before running each test case to catch any possible errors if some data is missing.

Setup

  • Pull and switch to the branch as-8871-ece-on-supported-product-types.
  • Enable ECE by running wp option update _wcpay_feature_stripe_ece 1 in your merchant's root directory.
  • If ECE doesn't render, ensure your site is running over HTTPS.

To alternate how the tax is calculated:

  • Go to WooCommerce > Settings to enable Taxes.
  • Go to WooCommerce > Settings > Tax. Change the "Calculate tax based on" option according to the test case.

Product Type: simple

Testing steps

In order to test this product type you'll need to create:

  • A simple product.
  • A simple virtual product.

Product Page

  • Virtual Product
    • Without Tax.
    • ❌ With Tax (Customer Shipping Address) – Virtual Product With Tax Error (Shipping)
    • ❌ With Tax (Customer Billing Address) – Virtual Product With Tax Error (Billing)
  • Physical Product
    • Without Tax
    • With Tax (Customer Shipping Address)
    • ❌ With Tax (Customer Billing Address) – Check Physical Product With Tax Error (Billing)

Also test in the Cart Shortcode Page, Checkout shortcode Page, Cart Block and Checkout Block.

Product Type: variable

This product is the parent of variations. It cannot be purchased; only its variations can be bought. Ensuring the ECE button renders properly on the product page is sufficient to verify that ECE is compatible with this product type.

Product Type: variation

Test cases

In order to test this product type you'll need to create the following products:

  • A variable product with virtual variations

    • Create a variable product.
    • Add an attribute with two values. e.g. color, red|green. Check the "Used for variations" options.
    • Create a variation for each attribute.
  • A variable product with physical (simple products) variations.

    • Create a variable product.
    • Add an attribute with two values. e.g. color, red|green.
    • Create a variation for each attribute.
  • A variable product with mixed products (simple and virtual) variations.

    • Create a variable product.
    • Add an attribute with two values. e.g. color, red|green.
    • Create a variation for each attribute.
    • Set one variation as "virtual".

Product Page

  • Virtual Products
    • Without Tax
    • ❌ With Tax (Customer Shipping Address) - Virtual Product With Tax Error (Shipping Address)
    • ❌ With Tax (Customer Billing Address) - Virtual Product With Tax Error (Billing Address)
  • Physical Products
    • Without Tax
    • With Tax (Customer Shipping Address)
    • ❌ With Tax (Customer Billing Address) – Check Physical Product With Tax Error (Billing)
  • Mixed Products (Virtual & Physical)
    • Virtual Variation
      • Without Tax
      • ❌ With Tax (Customer Shipping Address) - **Virtual Product With Tax Error
      • ❌ With Tax (Customer Billing Address) – Check Physical Product With Tax Error
        (Shipping Address)
    • Physical Variation
      • Without Tax
      • With Tax (Customer Shipping Address)
      • ❌ With Tax (Customer Billing Address) – Check **Physical Product With Tax Error

Product Type: subscription

Test cases

In order to test this product type you'll need to download and install the "WooCommerce Subscriptions" extension from https://woocommerce.com/my-account/downloads/.

Create two simple subscriptions:

  • A virtual subscription.
  • A simple subscription.

Product Page

  • Virtual
    • Without Tax
    • ❌ With Tax (Customer Shipping Address) - Virtual Product With Tax Error (Shipping Address)
    • ❌ With Tax (Customer Billing Address) - Virtual Product With Tax Error
  • Physical
    • Without Tax
    • With Tax (Customer Shipping Address)
    • ❌ With Tax (Customer Billing Address) – Check Physical Product With Tax Error

Product type: variable-subscription

This product is the parent of subscription variations. Ensuring the ECE button renders properly on the product page of a variable subscription is sufficient to verify that ECE is compatible with this product type.

Product type: subscription_variation

Test cases

In order to test this product type you'll need to install the WooCommerce Subscriptions plugin. You can download it from here.

Create A Variable subscription with virtual variations

  • Create a Variable subscription.
  • Add an attribute with two values. e.g. size, small|big. Check the "Used for variations" options.
  • Create a variation for each attribute.

A Variable subscription with simple variations.

  • Create a Variable subscription.
  • Add an attribute with two values. e.g. size, small|big.
  • Create a variation for each attribute.

A variable product with mixed products (simple and virtual) variations.

  • Create a variable product.
  • Add an attribute with two values. e.g. size, small|big.
  • Create a variation for each attribute.
  • Set one variation as "virtual".

Product Page

  • Virtual
    • Without Tax
    • ❌ With Tax (Customer Shipping Address) - Virtual Product With Tax Error (Shipping Address)
    • ❌ With Tax (Customer Billing Address) - Virtual Product With Tax Error (Billing Address)
  • Physical
    • Without Tax
    • With Tax (Customer Shipping Address)
    • ❌ With Tax (Customer Billing Address) – Check Physical Product With Tax Error (Billing)
  • Mixed Products (Virtual & Physical)
    • Virtual Variation
      • Without Tax
      • ❌ With Tax (Customer Shipping Address) - Virtual Product With Tax Error
      • ❌ With Tax (Customer Billing Address) – Virtual Product With Tax Error
        (Shipping Address)**
    • Physical Variation
      • Without Tax
      • With Tax (Customer Shipping Address)
      • ❌ With Tax (Customer Billing Address) – Check **Physical Product With Tax Error

Product type: booking

Testing steps

In order to test this product type you'll need to install the WooCommerce Bookings plugin. You can download it from here.

Create a simple booking

  • Go to Products > Add New.
  • Select "Bookable" from the product data section.
  • Set the cost in the "Costs" tab.
  • Publish.

Create a virtual booking

  • Go to Products > Add New.
  • Select "Bookable" from the product data section.
  • Mark the "Virtual" checkbox.
  • Set the cost in the "Costs" tab.
  • Publish.

Note: No need to test the ECE on the product page for this product type as it's currently not supported in that page.

Test cases

  • Simple Booking
    • Shortcode - Cart
      • Without Tax
      • With Tax (Customer Shipping Address)
      • ❌ With Tax (Customer Billing Address) – Physical Product With Tax Error
    • Shortcode - Checkout
      • Without Tax
      • With Tax (Customer Shipping Address)
      • ❌ With Tax (Customer Billing Address) – Physical Product With Tax Error
    • Blocks - Cart
      • Without Tax
      • With Tax (Customer Shipping Address)
      • ❌ With Tax (Customer Billing Address) – Physical Product With Tax Error
    • Blocks - Checkout
      • Without Tax
      • With Tax (Customer Shipping Address)
      • ❌ With Tax (Customer Billing Address) – Physical Product With Tax Error
  • Virtual Booking
    • Shortcode - Cart
      • Without Tax
      • ❌ With Tax (Customer Shipping Address) - Virtual Product With Tax Error
      • ❌ With Tax (Customer Billing Address) – Virtual Product With Tax Error
    • Shortcode - Checkout
      • Without Tax
      • ❌ With Tax (Customer Shipping Address) - Virtual Product With Tax Error
      • ❌ With Tax (Customer Billing Address) – Virtual Product With Tax Error
    • Blocks - Cart
      • Without Tax
      • ❌ With Tax (Customer Shipping Address) - Virtual Product With Tax Error
      • ❌ With Tax (Customer Billing Address) – Virtual Product With Tax Error
    • Blocks - Checkout
      • Without Tax
      • ❌ With Tax (Customer Shipping Address) - Virtual Product With Tax Error
      • ❌ With Tax (Customer Billing Address) – Virtual Product With Tax Error

Product type: bundles

Testing steps

In order to test this product type you'll need to install the Product Bundles plugin. You can download it from here.

Create a bundle with simple products

  • Go to Products > Add New.
  • Select "Product bundle" from the product data section.
  • Set the price.
  • Go to "Bundled Products" then add at least two simple products.
  • Publish.

Create a bundle with virtual products

  • Go to Products > Add New.
  • Select "Product bundle" from the product data section.
  • Set the price.
  • Go to "Bundled Products" then add at least two simple products.
  • Publish.

Create a bundle with mixed products (simple and virtual)

  • Go to Products > Add New.
  • Select "Product bundle" from the product data section.
  • Set the price.
  • Go to "Bundled Products" and add both a simple product and a virtual product.
  • Publish.

Test cases

  • Bundle - Simple products
    • Product Page
      • ❌ Without Tax
      • ❌ With Tax (Customer Shipping Address)
      • ❌ With Tax (Customer Billing Address)
      • It doesn't work because it asks for a shipping address but there's no shipping section in the payment sheet. Looks like a bug in the plugin. We could disable ECE entirely for this product type in the product page.
    • Shortcode - Cart
      • Without Tax
      • With Tax (Customer Shipping Address)
      • ❌ With Tax (Customer Billing Address) – Physical Product With Tax Error
    • Shortcode - Checkout
      • Without Tax
    • Blocks - Cart
      • Without Tax
      • With Tax (Customer Shipping Address)
      • ❌ With Tax (Customer Billing Address) – Physical Product With Tax Error
    • Blocks - Checkout
      • Without Tax
  • Bundle - virtual products
    • Product Page
      • Without Tax
      • ❌ With Tax (Customer Shipping Address)
      • ❌ With Tax (Customer Billing Address) – Physical Product With Tax Error
    • Shortcode - Cart
      • Without Tax
      • With Tax (Customer Shipping Address)
      • ❌ With Tax (Customer Billing Address) – Physical Product With Tax Error
    • Shortcode - Checkout
      • Without Tax
    • Blocks - Cart
      • Without Tax
    • Blocks - Checkout
      • Without Tax
  • Bundle - mixed products
    • Product Page
      • ❌ Without Tax
      • ❌ With Tax (Customer Shipping Address)
      • ❌ With Tax (Customer Billing Address)
    • Shortcode - Cart
      • Without Tax
      • With Tax (Customer Shipping Address)
      • ❌ With Tax (Customer Billing Address) – Physical Product With Tax Error
    • Shortcode - Checkout
      • Without Tax
    • Blocks - Cart
      • Without Tax
    • Blocks - Checkout
      • Without Tax

Product type: composite

Testing steps

In order to test this product type you'll need to install the Composite Products plugin. You can download it from here.

Create a composite product with simple products

  • Go to Products > Add New.
  • Select "Composite product" from the product data section.
  • Set the price.
  • Go to the "Components" tab
  • Add a couple of components, each containing two simple products.
  • Publish.

Note: No need to test the ECE on the product page for this product type as it's currently not supported in that page.

Test cases

  • Composite - Simple products
    • Blocks - Cart
      • Without Tax
    • Blocks - Checkout
      • Without Tax

Product type: mix-and-match

Testing steps

In order to test this product type you'll need to install the Mix and Match Products plugin. You can download it from here.

Create a "Mix and Match" product with simple products

  • Go to Products > Add New.
  • Select "Mix and Match product" from the product data section.
  • Set the price.
  • Go to the "Mix and Match" tab.
  • Select a couple simple products.
  • Publish.

Note: No need to test the ECE on the product page for this product type as it's currently not supported in that page.

Test cases

  • Mix and Match - Simple products
    • Blocks - Cart
      • Without Tax
    • Blocks - Checkout
      • Without Tax

Error types

  • Virtual Product With Tax Error (Shipping)
    • We can't determine the tax amount based on a shipping address because we don't have a shipping address.
    • There's no section to select a shipping address in the payment sheet.
  • Virtual Product With Tax Error (Billing)
    • We can't get the billing information from the payment method before displaying the payment sheet.
    • Tax amount is calculated using the store's country or whatever Default customer location" option is set to.
    • Payment is done but the amount shown was different.
    • There's no section to select a shipping address in the payment sheet so it seems to use the billing address instead.
  • Physical Product With Tax Error
    • Fails to display the tax amount based on the billing address since we can not determine the selected payment method before showing the payment sheet.

@asumaran asumaran self-assigned this Jun 20, 2024
@botwoo
Copy link
Collaborator

botwoo commented Jun 20, 2024

Test the build

Option 1. Jetpack Beta

  • Install and activate Jetpack Beta.
  • Use this build by searching for PR number 8987 or branch name as-8871-ece-on-supported-product-types in your-test.site/wp-admin/admin.php?page=jetpack-beta&plugin=woocommerce-payments

Option 2. Jurassic Ninja - available for logged-in A12s

🚀 Launch a JN site with this branch 🚀

ℹ️ Install this Tampermonkey script to get more options.


Build info:

  • Latest commit: 33d4f17
  • Build time: 2024-07-08 20:48:32 UTC

Note: the build is updated when a new commit is pushed to this PR.

Copy link
Contributor

github-actions bot commented Jun 20, 2024

Size Change: +652 B (0%)

Total Size: 1.27 MB

Filename Size Change
release/woocommerce-payments/dist/blocks-checkout.js 53 kB +33 B (0%)
release/woocommerce-payments/dist/express-checkout.js 6.31 kB +619 B (+11%) ⚠️
ℹ️ View Unchanged
Filename Size
release/woocommerce-payments/assets/css/admin.css 1.08 kB
release/woocommerce-payments/assets/css/admin.rtl.css 1.08 kB
release/woocommerce-payments/assets/css/success.css 173 B
release/woocommerce-payments/assets/css/success.rtl.css 173 B
release/woocommerce-payments/dist/blocks-checkout-rtl.css 2.08 kB
release/woocommerce-payments/dist/blocks-checkout.css 2.08 kB
release/woocommerce-payments/dist/bnpl-announcement-rtl.css 528 B
release/woocommerce-payments/dist/bnpl-announcement.css 529 B
release/woocommerce-payments/dist/bnpl-announcement.js 20.1 kB
release/woocommerce-payments/dist/cart-block.js 15.4 kB
release/woocommerce-payments/dist/cart.js 4.87 kB
release/woocommerce-payments/dist/checkout-rtl.css 600 B
release/woocommerce-payments/dist/checkout.css 600 B
release/woocommerce-payments/dist/checkout.js 31.7 kB
release/woocommerce-payments/dist/express-checkout-rtl.css 154 B
release/woocommerce-payments/dist/express-checkout.css 154 B
release/woocommerce-payments/dist/index-rtl.css 41 kB
release/woocommerce-payments/dist/index.css 40.9 kB
release/woocommerce-payments/dist/index.js 295 kB
release/woocommerce-payments/dist/multi-currency-analytics.js 1.05 kB
release/woocommerce-payments/dist/multi-currency-rtl.css 3.41 kB
release/woocommerce-payments/dist/multi-currency-switcher-block.js 59.8 kB
release/woocommerce-payments/dist/multi-currency.css 3.41 kB
release/woocommerce-payments/dist/multi-currency.js 55 kB
release/woocommerce-payments/dist/order-rtl.css 730 B
release/woocommerce-payments/dist/order.css 730 B
release/woocommerce-payments/dist/order.js 42 kB
release/woocommerce-payments/dist/payment-gateways-rtl.css 1.35 kB
release/woocommerce-payments/dist/payment-gateways.css 1.35 kB
release/woocommerce-payments/dist/payment-gateways.js 38.9 kB
release/woocommerce-payments/dist/payment-request-rtl.css 154 B
release/woocommerce-payments/dist/payment-request.css 154 B
release/woocommerce-payments/dist/payment-request.js 5.9 kB
release/woocommerce-payments/dist/plugins-page-rtl.css 386 B
release/woocommerce-payments/dist/plugins-page.css 386 B
release/woocommerce-payments/dist/plugins-page.js 19.4 kB
release/woocommerce-payments/dist/product-details-rtl.css 397 B
release/woocommerce-payments/dist/product-details.css 398 B
release/woocommerce-payments/dist/product-details.js 11.2 kB
release/woocommerce-payments/dist/settings-rtl.css 11.2 kB
release/woocommerce-payments/dist/settings.css 11.1 kB
release/woocommerce-payments/dist/settings.js 215 kB
release/woocommerce-payments/dist/subscription-edit-page.js 668 B
release/woocommerce-payments/dist/subscription-product-onboarding-modal-rtl.css 524 B
release/woocommerce-payments/dist/subscription-product-onboarding-modal.css 524 B
release/woocommerce-payments/dist/subscription-product-onboarding-modal.js 19.5 kB
release/woocommerce-payments/dist/subscription-product-onboarding-toast.js 694 B
release/woocommerce-payments/dist/subscriptions-empty-state-rtl.css 120 B
release/woocommerce-payments/dist/subscriptions-empty-state.css 120 B
release/woocommerce-payments/dist/subscriptions-empty-state.js 18.6 kB
release/woocommerce-payments/dist/tokenized-payment-request-rtl.css 154 B
release/woocommerce-payments/dist/tokenized-payment-request.css 154 B
release/woocommerce-payments/dist/tokenized-payment-request.js 6.62 kB
release/woocommerce-payments/dist/tos-rtl.css 235 B
release/woocommerce-payments/dist/tos.css 235 B
release/woocommerce-payments/dist/tos.js 21 kB
release/woocommerce-payments/dist/woopay-direct-checkout.js 5.25 kB
release/woocommerce-payments/dist/woopay-express-button-rtl.css 154 B
release/woocommerce-payments/dist/woopay-express-button.css 154 B
release/woocommerce-payments/dist/woopay-express-button.js 15.6 kB
release/woocommerce-payments/dist/woopay-rtl.css 4.26 kB
release/woocommerce-payments/dist/woopay.css 4.23 kB
release/woocommerce-payments/dist/woopay.js 69.6 kB
release/woocommerce-payments/includes/subscriptions/assets/css/plugin-page.css 625 B
release/woocommerce-payments/includes/subscriptions/assets/js/plugin-page.js 814 B
release/woocommerce-payments/vendor/automattic/jetpack-assets/build/i18n-loader.js 2.46 kB
release/woocommerce-payments/vendor/automattic/jetpack-assets/src/js/i18n-loader.js 1.02 kB
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/jetpack-sso-admin-create-user.css 198 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/jetpack-sso-admin-create-user.js 20 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/jetpack-sso-admin-create-user.rtl.css 198 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/jetpack-sso-login.css 625 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/jetpack-sso-login.js 20 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/jetpack-sso-login.rtl.css 626 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/jetpack-sso-users.js 392 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/tracks-ajax.js 521 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/tracks-callables.js 584 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/src/sso/jetpack-sso-admin-create-user.css 215 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/src/sso/jetpack-sso-admin-create-user.js 521 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/src/sso/jetpack-sso-login.css 721 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/src/sso/jetpack-sso-login.js 412 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/src/sso/jetpack-sso-users.js 520 B
release/woocommerce-payments/vendor/automattic/jetpack-identity-crisis/babel.config.js 159 B
release/woocommerce-payments/vendor/automattic/jetpack-identity-crisis/build/index.css 2.36 kB
release/woocommerce-payments/vendor/automattic/jetpack-identity-crisis/build/index.js 13.6 kB
release/woocommerce-payments/vendor/automattic/jetpack-identity-crisis/build/index.rtl.css 2.36 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/about.css 1.04 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/admin-empty-state.css 294 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/admin-order-statuses.css 408 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/admin.css 3.59 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/checkout.css 301 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/modal.css 746 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/view-subscription.css 574 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/wcs-upgrade.css 414 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/admin-pointers.js 543 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/admin.js 9.4 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/jstz.js 6.78 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/jstz.min.js 3.84 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/meta-boxes-coupon.js 545 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/meta-boxes-subscription.js 2.52 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/moment.js 22.2 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/moment.min.js 11.7 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/payment-method-restrictions.js 1.29 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/wcs-meta-boxes-order.js 507 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/frontend/payment-methods.js 358 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/frontend/single-product.js 428 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/frontend/view-subscription.js 1.38 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/frontend/wcs-cart.js 782 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/modal.js 1.09 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/wcs-upgrade.js 1.26 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/build/index.css 391 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/build/index.js 3.04 kB

compressed-size-action

@asumaran asumaran force-pushed the as-8871-ece-on-supported-product-types branch from d889127 to 246aebe Compare June 20, 2024 23:24
@asumaran asumaran changed the title WIP Add ECE support for multiple product types Jun 20, 2024
@asumaran asumaran force-pushed the as-8871-ece-on-supported-product-types branch from 246aebe to 6f7c254 Compare June 21, 2024 11:04
asumaran added 2 commits June 26, 2024 01:31
The bundle plugin has multiple .qty inputs, and the one we use to determine the quantity is the last input, which is of the number type.
@asumaran asumaran marked this pull request as ready for review July 2, 2024 01:36
@asumaran asumaran requested review from a team and cesarcosta99 and removed request for a team July 2, 2024 01:36
Copy link
Contributor

@rafaelzaleski rafaelzaleski left a comment

Choose a reason for hiding this comment

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

@asumaran, I’m still working through the many test cases, but one issue stands out: we’re rendering ECE payment methods in scenarios where they’re known to fail or charge incorrectly, especially concerning taxes.

We should verify the cart and store settings to enhance the shopper experience, ensuring we only display payment methods when we’re confident the payment can be processed successfully.

The other feedback that I can give based on what I've already tested:

Bundle - Virtual Products

  • Product page
    • Worked for taxes calculated based on billing address but failed when based on shipping address. When based on shipping address, it adds taxes based in the billing address from GPay.
    • Also, when calculated based on billing, it shows the incorrect amount in the GPay prompt but charges correctly. For instance, it shows the value without taxes but charges with taxes, which was the correct amount.

Bundle - Mixed Products

  • Product page: the buttons are rendering in the page (if they don't work we shouldn't render them), but it's not possible to finish the payment:

The following problems were found: The payment request button is not supported in United States (US) because some required fields couldn't be verified. Please proceed to the checkout page and try again. Shipping First name is a required field. Shipping Last name is a required field. Shipping Country / Region is a required field. Shipping Street address is a required field. Shipping Town / City is a required field. Shipping State is a required field. Shipping ZIP Code is a required field. Please enter an address to continue.

@asumaran
Copy link
Contributor Author

asumaran commented Jul 5, 2024

we’re rendering ECE payment methods in scenarios where they’re known to fail or charge incorrectly, especially concerning taxes.

@rafaelzaleski That's correct. I believe hiding ECE for those cases deserves its own issue in case we don't find a solution. I didn't include it in this PR because the testing could have been nearly endless 😀 (or maybe not, but I thought on handling it separately to simplify the testing process).

Bundle - Virtual Products
Worked for taxes calculated based on billing address.

You sure? You might get charged the correct amount but what was shown to the user was incorrect.

Screenshot 2024-07-05 at 2 04 18 PM

Assuming:
USA TAX is set to 11%
Perú Tax is set to 35%

Check this example using a Bundle of virtual products. It shows $3.74 as tax amount. Product is 34 + 34*0.11 = $37.74

However the user is charged $45.90
Screenshot 2024-07-05 at 2 05 22 PM

Although the end result is correct, to me that's incorrect and I marked them as failed. We can't show the user an incorrect amount then charge another.

Bundle - Mixed Products
Product page: the buttons are rendering in the page (if they don't work we shouldn't render them), but it's not possible to finish the payment:

I agree. As mentioned above I think we should handle it in a separate issue.

@rafaelzaleski
Copy link
Contributor

The only inconsistency I found when testing product bundles, composite, and mix-and-match was:

Bundle - virtual products

  • Product Page
    -- Does not work when taxes are enabled (based on shipping or billing).

I'll test Bookings on Monday.

Copy link
Contributor

@rafaelzaleski rafaelzaleski left a comment

Choose a reason for hiding this comment

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

Overall, the code looks good.

I noticed extensive use of jQuery for simple selectors, likely because the code was copied from PRBs. I won’t extend this review further on that point, as we have a dedicated issue to reduce jQuery usage in the ECE implementation.

I also noticed code related to WooCommerce Deposits, even though these aren’t listed in WC_Payments_Express_Checkout_Button_Helper->supported_product_types. While this is in the scope of issue #8871, I’d rather not complicate this PR further. Could you handle this in a separate PR? Please either remove the code related to deposits if we aren’t supporting them, or ensure all necessary support is included before closing issue #8871.

Please focus on my comments as I believe they are blockers.

Thanks for all your hard work! 🙏

client/express-checkout/utils/index.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@cesarcosta99 cesarcosta99 left a comment

Choose a reason for hiding this comment

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

I appreciate the updates you did, great work! Just one last thing that came through in the latest changes.

All tests that I run passed 🎉

  • Virtual Product ✅
  • Physical Product ✅
    • Without Tax
    • With Tax (Customer Shipping Address)
  • Ensure the ECE button renders with a variable product ✅
  • Product Type: variation
    • Virtual Products
    • Physical Products
      • Without Tax
      • With Tax (Customer Shipping Address)
    • Mixed Products (Virtual & Physical)
      • Virtual Variation
      • Physical Variation
        • Without Tax
        • With Tax (Customer Shipping Address)
  • Product Type: subscription
    • Virtual
    • Physical
      • Without Tax
      • With Tax (Customer Shipping Address)
  • Ensure the ECE button renders with a variable subscription ✅
  • Product Type: subscription_variation
    • Virtual
    • Physical
      • Without Tax
      • With Tax (Customer Shipping Address)
    • Mixed (Virtual & Physical)
      • Virtual Variation
      • Physical Variation
        • Without Tax
        • With Tax (Customer Shipping Address)

Given that the tests that didn't pass won't work on PRBs as well we should work on disabling ECE for those particular cases or figuring out a solution in a separate issue.
#8987 (comment)

We should verify the cart and store settings to enhance the shopper experience, ensuring we only display payment methods when we’re confident the payment can be processed successfully.
#8987 (review)

To touch on the above, it looks like this tax thing is already an issue present in PRBs (#8373). Since this is not a regression, IMO, we should use that spike to address this. The testing in this PR is extremely extensive already, and during that spike we can take advantage of the test instructions here to ensure everything is working as expected.

Another aspect we should consider when revisiting this is to confirm if it really makes sense to tax virtual products. Maybe we should consult the team working on the tax feature and/or tax experts to be sure we're applying taxes correctly. Based on whether tax or not virtual products, we can decide to either hide the ECE button, or fix the application of the tax for the (virtual) products where it's buggy. cc @bborman22

client/express-checkout/utils/index.ts Outdated Show resolved Hide resolved
changelog/as-8871-ece-on-supported-product-types Outdated Show resolved Hide resolved
@rafaelzaleski
Copy link
Contributor

I’ve finished testing WC Bookings, and it performs as described in the testing instructions.

@asumaran
Copy link
Contributor Author

asumaran commented Jul 8, 2024

I also noticed code related to WooCommerce Deposits, even though these aren’t listed in WC_Payments_Express_Checkout_Button_Helper->supported_product_types. While this is in the scope of issue #8871, I’d rather not complicate this PR further. Could you handle this in a separate PR?

@rafaelzaleski Deposits wasn't part of the list on the issue and I missed it completely. I'll create an issue to make sure we are supporting Deposits as well.

--

Issue created #9067

This is to make it possible it can be used from class-wc-payments-express-checkout-ajax-handler.php
@asumaran
Copy link
Contributor Author

asumaran commented Jul 8, 2024

The only inconsistency I found when testing product bundles, composite, and mix-and-match was:

Bundle - virtual products

Product Page
-- Does not work when taxes are enabled (based on shipping or billing).

@rafaelzaleski You are correct. I must have copied it incorrectly from my list, which correctly shows that bundles with virtual products fail with taxes. I've updated the PR description to reflect the correct outcome.

@asumaran
Copy link
Contributor Author

asumaran commented Jul 8, 2024

Thanks for your feedback, @cesarcosta99 @rafaelzaleski. I think I addressed all your comments and code suggestions, also created issues where needed. If the PR looks good to you, would you mind approving it?

Copy link
Contributor

@rafaelzaleski rafaelzaleski left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for making the changes and creating the issue for WC Deposits.

@asumaran asumaran enabled auto-merge July 9, 2024 14:20
Copy link
Contributor

@cesarcosta99 cesarcosta99 left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for addressing all of our feedback and creating the follow-up issues 💯

@asumaran asumaran added this pull request to the merge queue Jul 9, 2024
Merged via the queue into develop with commit 6d4e054 Jul 9, 2024
23 checks passed
@asumaran asumaran deleted the as-8871-ece-on-supported-product-types branch July 9, 2024 16:36
jessepearson pushed a commit that referenced this pull request Jul 11, 2024
Co-authored-by: César Costa <10233985+cesarcosta99@users.noreply.github.com>
lovo-h pushed a commit that referenced this pull request Aug 1, 2024
Co-authored-by: César Costa <10233985+cesarcosta99@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants