woocommerce / woocommerce-gateway-paypal-express-checkout

59 stars 64 forks source link

Cannot Place Order: '' is not a valid country code. #858

Open adeelejaz opened 3 years ago

adeelejaz commented 3 years ago

Describe the bug

I recently updated to latest version of woocommerce and the PayPal Express plugin. Since the update, no one can checkout. We do not use any other payment method. Pressing the "Place Order" button on the checkout screen shows the following error: '' is not a valid country code.

To reproduce

  1. Hit the PayPal button on the Cart page.
  2. Login to PayPal and authorise the transaction
  3. Come back to the checkout page, accept terms and conditions, and click "Place Order" button

Expected behavior

Place the order

Environment:

Additional details

I turned on logs, and can confirm that PayPal does have COUNTRYCODE value being sent correctly.

System status ` ### WordPress Environment ### WordPress address (URL): Site address (URL): WC Version: 5.1.0 REST API Version: ✔ 5.1.0 WC Blocks Version: ✔ 4.7.0 Action Scheduler Version: ✔ 3.1.6 WC Admin Version: ✔ 2.1.2 Log Directory Writable: ✔ WP Version: 5.7 WP Multisite: – WP Memory Limit: 256 MB WP Debug Mode: – WP Cron: ✔ Language: en_GB External object cache: – ### Server Environment ### Server Info: nginx/1.18.0 PHP Version: 7.4.15 PHP Post Max Size: 8 MB PHP Time Limit: 120 PHP Max Input Vars: 1000 cURL Version: 7.61.1 OpenSSL/1.0.2k SUHOSIN Installed: – MySQL Version: 5.5.5-10.4.13-MariaDB-log Max Upload Size: 2 MB Default Timezone is UTC: ✔ fsockopen/cURL: ✔ SoapClient: ❌ Your server does not have the SoapClient class enabled - some gateway plugins which use SOAP may not work as expected. DOMDocument: ✔ GZip: ✔ Multibyte String: ❌ Your server does not support the mbstring functions - this is required for better character encoding. Some fallbacks will be used instead for it. Remote Post: ✔ Remote Get: ✔ ### Database ### WC Database Version: 5.0.0 WC Database Prefix: wp_xxx_ Total Database Size: 25.37MB Database Data Size: 15.28MB Database Index Size: 10.09MB ### Post Type Counts ### attachment: 6 br_notice: 3 custom_css: 1 et_pb_layout: 1 nav_menu_item: 21 page: 14 post: 1 product: 22 revision: 146 shop_order: 789 shop_order_refund: 109 ### Security ### Secure connection (HTTPS): ✔ Hide errors from visitors: ✔ ### Active Plugins (10) ### Cart Notices for WooCommerce: by BeRocket – 3.5.2.2 Classic Editor: by WordPress Contributors – 1.6 Feed Them Social - for Twitter feed, Youtube, and more: by SlickRemix – 2.9.4 WooCommerce Blocks: by Automattic – 4.7.0 WooCommerce Admin: by WooCommerce – 2.1.2 WooCommerce Conversion Tracking: by weDevs – 2.0.8 WooCommerce Easy Booking: by @_Ashanna – 3.0.2 WooCommerce PayPal Checkout Gateway: by WooCommerce – 2.1.1 WooCommerce: by Automattic – 5.1.0 WP Mail Logging: by MailPoet – 1.9.7 ### Inactive Plugins (3) ### Akismet Anti-Spam: by Automattic – 4.1.9 Feed Them Premium: by Joe – 1.0.0 Hello Dolly: by Matt Mullenweg – 1.7.2 ### Must Use Plugins (1) ### ET Support Center :: Must-Use Plugins Autoloader: by Elegant Themes – ### Settings ### API Enabled: ✔ Force SSL: – Currency: GBP (£) Currency Position: left Thousand Separator: , Decimal Separator: . Number of Decimals: 2 Taxonomies: Product Types: external (external) grouped (grouped) simple (simple) variable (variable) Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog) exclude-from-search (exclude-from-search) featured (featured) outofstock (outofstock) rated-1 (rated-1) rated-2 (rated-2) rated-3 (rated-3) rated-4 (rated-4) rated-5 (rated-5) Connected to WooCommerce.com: – ### WC Pages ### Shop base: #82 - /book-online/ Basket: #83 - /cart/ Checkout: #84 - /checkout/ My account: #85 - /my-account/ Terms and conditions: #124 - /terms-conditions/ ### Theme ### Name: Divi Child Theme Version: 1.0.0 Author URL: Child Theme: ✔ Parent Theme Name: Divi Parent Theme Version: 4.9.2 Parent Theme Author URL: http://www.elegantthemes.com WooCommerce Support: ✔ ### Templates ### Overrides: Divi-Child/woocommerce/emails/customer-processing-order.php ### Action Scheduler ### Complete: 53 Oldest: 2021-02-16 06:31:52 +0000 Newest: 2021-03-18 19:15:30 +0000 Pending: 1 Oldest: 2021-03-19 07:25:27 +0000 Newest: 2021-03-19 07:25:27 +0000 ### Status report information ### Generated at: 2021-03-19 04:11:06 +00:00 `
motorichard commented 3 years ago

Did you find a solution to this? We're having the same issue.

imaginemonkey commented 3 years ago

We are also experiencing these issues on a client's website, as well. Any updates that you can give us here would be great.

ldr2273 commented 3 years ago

Hi @adeelejaz -

Thanks for reporting this.

I just tested the most recent version of the PayPal Checkout plugin and WooCommerce on a default installation, and I wasn't able to replicate this. I was able to place an order successfully:

Order Link: https://d.pr/i/wUeVog

This lets me know that the problem is unique to your site's environment. Can you please test with just WooCommerce and PayPal Checkout, along with a default theme like Storefront, active? For more information on testing for conflicts, please see: https://docs.woocommerce.com/document/woocommerce-self-service-guide/

Let us know how this goes.

imaginemonkey commented 3 years ago

Hi @adeelejaz -

Thanks for reporting this.

I just tested the most recent version of the PayPal Checkout plugin and WooCommerce on a default installation, and I wasn't able to replicate this. I was able to place an order successfully:

Order Link: https://d.pr/i/wUeVog

This lets me know that the problem is unique to your site's environment. Can you please test with just WooCommerce and PayPal Checkout, along with a default theme like Storefront, active? For more information on testing for conflicts, please see: https://docs.woocommerce.com/document/woocommerce-self-service-guide/

Let us know how this goes.

Hi,

We are also experiencing this same exact issue within the last 4 days, and have been using this plugin for over a year without issue. Someone else here is also reporting this issue suddenly, as well. So, yes 3 reports, but all within the same timeframe.

Our client has an influx of new reports from users who cannot purchase due to this problem, when just 4 days ago there was no such issue. No theme updates, no major plugin updates in that timeframe either.

adeelejaz commented 3 years ago

Hi @ldr2273, did you test this on an installation that was upgraded from a previous version of Woocommerce and the plugin? Because in our cases, we upgraded existing installations.

I also tried downgrading the plugin to the older version (that worked), but still got an error. So I'm assuming its an issue with latest version of Woocommerce and the way plugin handles it. I'll dig more in code today and share what I may find.

imaginemonkey commented 3 years ago

Hi @ldr2273, did you test this on an installation that was upgraded from a previous version of Woocommerce and the plugin? Because in our cases, we upgraded existing installations.

I also tried downgrading the plugin to the older version (that worked), but still got an error. So I'm assuming its an issue with latest version of Woocommerce and the way plugin handles it. I'll dig more in code today and share what I may find.

Hi, this is actually Imagine Monkey (another developer experiencing issues with this plugin suddenly. We upgraded WordPress to the latest version recently, yes. That might be when it started actually.

vidishpurohit commented 3 years ago

@adeelejaz @ldr2273 We are facing exact same issue. Do you have any more details about the issue? I tried troubleshooting it with Sandbox mode but in that, user profile has a preselected country. So this is not reproduced in sandbox mode.

It would be great if you can share some thoughts on this.

adeelejaz commented 3 years ago

@vidishpurohit We use it where the customer is checkout directly from cart page using the PayPal Express Button, so you never get an option to preselect a country (so not clear what you are referring to or how I can check that).

vidishpurohit commented 3 years ago

Have a look at this video. It will clarify for you.

https://www.loom.com/share/379e48b894874be5aef3dbaaaa237ef5

On Thu, Mar 25, 2021, 10:34 PM Adeel Ejaz @.***> wrote:

@vidishpurohit https://github.com/vidishpurohit We use it where the customer is checkout directly from cart page using the PayPal Express Button, so you never get an option to preselect a country (so not clear what you are referring to or how I can check that).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/woocommerce/woocommerce-gateway-paypal-express-checkout/issues/858#issuecomment-807105582, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACC3IKIKS7MJH52OG3UCNE3TFNUKJANCNFSM4ZOAUQSA .

KKCreative77 commented 3 years ago

We are also experiencing this problem, but for only one type of product (vouchers). Is there any further information yet please?

RaminHH commented 3 years ago

We are also experiencing this problem, the only solution so far is to downgrade WooCommerce to version: 5.0, then it works again.

curiouslt commented 3 years ago

Having the same issue. I tried to chat with Woo and was told it was a RAM issue. It's not. I'm going to try to rollback and see if that works.

KKCreative77 commented 3 years ago

So frustrating - one minute it works ok then later it's back to the error message!

mattallan commented 3 years ago

I'm trying to reproduce this issue but not having any luck.

Can you please provide details on the billing address being used to replicate this bug? Also, any other checkout details like that may help us reproduce this, i.e. is it a virtual product? Thanks!

adeelejaz commented 3 years ago

@mattallan There is no billing address setup on WooCommerce side as it is call configured in PayPal. And in my tests, the issue occurs with all product types. The issue seems to be in a way WooCommerce checks for fields in the latest version and expecting a field that PayPal may not be sending. More details on PR opened by @Konamiman.