woocommerce / woocommerce-gateway-paypal-express-checkout

58 stars 65 forks source link

Do not restrict other payment gateways when customer attempts to checkout using an unsupported currency #853

Open AashikP opened 3 years ago

AashikP commented 3 years ago

Describe the bug

With PayPal Checkout enabled, if a customer attempts to checkout using an unsupported currency, the extension will not let them enter credit card details on the checkout page.

To reproduce

  1. Create a test site with ZAR as the base currency.
  2. Install and configure the Stripe gateway and the WooCommerce PayPal Checkout gateway.
  3. Try to buy a product on the frontend. The Stripe fields will appear disabled on the checkout page. The browser console will show several errors, all coming from the PayPal Express Checkout plugin :
    jquery-migrate.min.js?ver=3.3.2:2 JQMIGRATE: Migrate is installed, version 3.3.2
    js:1 Failed to load resource: the server responded with a status of 400 ()
    wc-gateway-ppec-smart-payment-buttons.js?ver=2.1.1:50 Uncaught TypeError: Cannot read property 'FUNDING' of undefined
    at String.<anonymous> (wc-gateway-ppec-smart-payment-buttons.js?ver=2.1.1:50)
    at Function.each (jquery.min.js?ver=3.5.1:2)
    at getFundingMethods (wc-gateway-ppec-smart-payment-buttons.js?ver=2.1.1:49)
    at render (wc-gateway-ppec-smart-payment-buttons.js?ver=2.1.1:102)
    at HTMLBodyElement.dispatch (jquery.min.js?ver=3.5.1:2)
    at HTMLBodyElement.v.handle (jquery.min.js?ver=3.5.1:2)
    at Object.trigger (jquery.min.js?ver=3.5.1:2)
    at HTMLBodyElement.<anonymous> (jquery.min.js?ver=3.5.1:2)
    at Function.each (jquery.min.js?ver=3.5.1:2)
    at s.fn.init.each (jquery.min.js?ver=3.5.1:2)

https://d.pr/i/w1fWQ7+

This can also be replicated with WooCommerce Payments instead of the Stripe extension. PayPal checkout does block the customer from entering credit card fields to the checkout page.

Expected behavior

If the customer is attempting to checkout using a currency not supported by PayPal, just hide the payment gateway and do not interfere with other payment gateways that do support the currency.

Environment (please complete the following information):

Additional details

On a site with just ZAR set as the base currency, there's no point in enabling the checkout extension because the gateway does not support this currency. However, this becomes a problem on sites that offer multi-currency checkout options for their customers.

squilib commented 3 years ago

I reported the problem the first time on worpress.org more than 1 month ago. The base currency of my shop is in euro (not ZAR). My customers from South Africa can't checkout with PayPal or Stripe. PayPal checkout does block the customers from entering credit card fields to the checkout page (see the attachment) Thank you stripe