woocommerce / woocommerce-paypal-payments

https://wordpress.org/plugins/woocommerce-paypal-payments/
GNU General Public License v2.0
62 stars 48 forks source link

formatExpiry called on select fields and breaks other payment processors #1284

Closed taxilian closed 1 year ago

taxilian commented 1 year ago

Describe the Bug

When this plugin is enabled and another payment plugin is also enabled which uses a select dropdown for the "cardExpiryMonth" (.wc-credit-card-form-card-expiry) or year fields then this plugin prevents that one from working.

I traced it through the javascript to a point where a "formatExpiry" function is called on the field

To Reproduce

  1. Install the paypal plugin
  2. Install the Helcim plugin
  3. On the checkout page try to select the expiration month or year of the helcim plugin

Expected Behavior

The plugin should never mess with fields that don't belong to it -- at the very least it should definitely not be trying to format the value of a select field

Actual Behavior

It's impossible to set the dropdown value of a select field with class "wc-credit-card-form-card-expiry" while the paypal plugin is enabled on the checkout page

Environment

taxilian commented 1 year ago

Hmm; it looks like the formatExpiry function is actually coming from the 'js/jquery-payment/jquery.payment.min.js' file in the woocommerce code; it doesn't happen if paypal isn't installed, though, so the compatibility issue is more nuanced. Still trying to figure it out, but any ideas would be appreciated. I'd like to be able to use this plugin but I can't if it breaks my other ones

taxilian commented 1 year ago

Okay; kept digging and now I'm convinced that it isn't the fault of this plugin, this plugin must just be somehow triggering woocommerce to include a particular file (woocomerce/assets/js/frontend/credit-card-from.min.js) which adds it. still working on a fix, but I'll stop pointing fingers when the relationship appears to be coincidental -- hopefully if someone else hits this the record of this issue will help point them in the right direction more quickly