woocommerce / woocommerce

A customizable, open-source ecommerce platform built on WordPress. Build any commerce solution you can imagine.
https://woocommerce.com
9.41k stars 10.76k forks source link

Billing country doesn't appear in dropdown nor automatically (maxmind) checkout page #43853

Closed morv96 closed 9 months ago

morv96 commented 9 months ago

Prerequisites

Describe the bug

country dropdown not appear in "BILLING" section, and appear only if Shipping enable UNDER "SHIPPING" section at order checkout page. i enter maxmind license, and it works and apear correctly when SHIPPING ENABLE as below: image

and i see in checkout correctly this: image

but when i change to "disable shipping & shipping calculation" as below: image

i don;t have longer dropdown country list and country doesn't appear in "Billing" at checkout form as below: image

i can see country dropdown in both billing % shipping at checkout form only if in admin pannel Shipping are enabled.

WC version: 8.5.1 no any pluging beside WC Template: storfront I tried to clear cache -- not working! i go to Dashboard> Setting> Permalink reproduce .htaccess- Doesn't working!

i reproduce the bug again and again

Expected behavior

show country dropdown under billing section in checkout form. image

Actual behavior

doesn't show any country and dropdown country field are empty image

Steps to reproduce

  1. i set "disabble shipping & shipping calculation"
  2. than i go to cart, chose item and go to checkout page
  3. i can't see or chose country in country dropdown field.

when i do the above & enabling Shipping by steps and select shipping to all countries/sale countries, than i can see the dropdown country under "shipping" checkout form.

i create that website in 2 different servers (use hostinger for wordpress / namecheap for wordpress)

WordPress Environment

`

WordPress Environment

WordPress address (URL): https://my-domain Site address (URL): https://my-domain WC Version: 8.5.1 REST API Version: ✔ 8.5.1 WC Blocks Version: ✔ 11.8.0-dev Action Scheduler Version: ✔ 3.7.1 Log Directory Writable: ✔ WP Version: 6.4.2 WP Multisite: – WP Memory Limit: 512 MB WP Debug Mode: – WP Cron: ✔ Language: en_US External object cache: –

Server Environment

Server Info: LiteSpeed PHP Version: 8.1.26 PHP Post Max Size: 256 MB PHP Time Limit: 300 PHP Max Input Vars: 5000 cURL Version: 7.87.0 OpenSSL/1.1.1w

SUHOSIN Installed: – MySQL Version: 10.11.6-MariaDB-cll-lve Max Upload Size: 256 MB Default Timezone is UTC: ✔ fsockopen/cURL: ✔ SoapClient: ✔ DOMDocument: ✔ GZip: ✔ Multibyte String: ✔ Remote Post: ✔ Remote Get: ✔

Database

WC Database Version: 8.5.1 WC Database Prefix: wp_ Total Database Size: 5.41MB Database Data Size: 3.71MB Database Index Size: 1.70MB wp_woocommerce_sessions: Data: 0.16MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_order_itemmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_actions: Data: 0.02MB + Index: 0.11MB + Engine InnoDB wp_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_logs: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_comments: Data: 0.02MB + Index: 0.09MB + Engine InnoDB wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_options: Data: 2.48MB + Index: 0.06MB + Engine InnoDB wp_postmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_posts: Data: 0.06MB + Index: 0.06MB + Engine InnoDB wp_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_term_relationships: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_usermeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wc_admin_notes: Data: 0.06MB + Index: 0.00MB + Engine InnoDB wp_wc_admin_note_actions: Data: 0.05MB + Index: 0.02MB + Engine InnoDB wp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_customer_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_orders: Data: 0.02MB + Index: 0.11MB + Engine InnoDB wp_wc_orders_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_order_addresses: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_order_operational_data: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_order_product_lookup: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_wc_order_stats: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_product_attributes_lookup: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_product_download_directories: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_product_meta_lookup: Data: 0.02MB + Index: 0.09MB + Engine InnoDB wp_wc_rate_limits: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB

Post Type Counts

attachment: 1 page: 6 post: 2 product: 2 shop_order_placehold: 20 wp_navigation: 1 wp_template: 2

Security

Secure connection (HTTPS): ✔ Hide errors from visitors: ✔

Active Plugins (1)

WooCommerce: by Automattic – 8.5.1

Inactive Plugins (2)

Hostinger: by Hostinger – 2.0.1 SpeedyCache: by Softaculous Team – 1.1.4

Settings

API Enabled: – Force SSL: – Currency: EUR (€) Currency Position: right_space 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 Woo.com: – Enforce Approved Product Download Directories: ✔ HPOS feature screen enabled: ✔ HPOS feature enabled: ✔ Order datastore: Automattic\WooCommerce\Internal\DataStores\Orders\OrdersTableDataStore HPOS data sync enabled: –

WC Pages

Shop base: #7 - /index.php/shop/ Cart: #8 - /index.php/cart/ Checkout: #9 - /index.php/checkout/ My account: #10 - /index.php/my-account/ Terms and conditions: ❌ Page not set

Theme

Name: Storefront Version: 4.5.4 Author URL: https://woo.com/ Child Theme: ❌ – If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: How to create a child theme WooCommerce Support: ✔

Templates

Overrides: –

Admin

Enabled Features: activity-panels analytics product-block-editor coupons core-profiler customer-effort-score-tracks import-products-task experimental-fashion-sample-products shipping-smart-defaults shipping-setting-tour homescreen marketing mobile-app-banner navigation onboarding onboarding-tasks product-variation-management product-virtual-downloadable product-external-affiliate product-grouped remote-inbox-notifications remote-free-extensions payment-gateway-suggestions shipping-label-banner subscriptions store-alerts transient-notices woo-mobile-welcome wc-pay-promotion wc-pay-welcome-page

Disabled Features: customize-store minified-js new-product-management-experience product-linked settings async-product-editor-category-field

Daily Cron: ✔ Next scheduled: 2024-01-23 11:08:01 +00:00 Options: ✔ Notes: 64 Onboarding: completed

Action Scheduler

Complete: 55 Oldest: 2024-01-22 11:09:08 +0000 Newest: 2024-01-22 12:56:46 +0000

Pending: 1 Oldest: 2024-01-23 11:09:08 +0000 Newest: 2024-01-23 11:09:08 +0000

Status report information

Generated at: 2024-01-22 13:01:59 +00:00 `

Isolating the problem

mikejolley commented 9 months ago

Hello

I'm unable to replicate this now but it happened for a brief moment. I'm thinking the value of woocommerce_allowed_countries may be wrong.

@morv96 are you able to look inside the database and see what the option woocommerce_allowed_countries is saved as? It's in the wp_options table.

It should be 'all', but if there is anything else there such as an empty string that would cause this behaviour. It would be a simple fix if this is the case.

morv96 commented 9 months ago

Hi Again.

as for your question it have 'all' and it correct as you can see below: image


ALSO, I have notice that if you set woocommerce product with no shipping as below: image

and than you set enable or disable than it work good and country are appear. under "BILLING" in checkout page (despite it enable/disable which is weird and make people to confused)

BUT

if you disable shipping on Woocommerce setting BUT not Disabled it under some Product as above, than the problem appear.

My suggestion, you need that woocommerce Setting page will "FORCE" enable/disable shipping on all product if user decide to disabled it from Woocommerce settings page

mikejolley commented 9 months ago

Given it occurred a moment my end, and all you have installed are caching plugins, I'm still thinking its caching of some sort. It could be that toggling the other settings invalided or disabled caching causing the dropdown to work correctly. Geolocation for example may introduce cache busting on the frontend.

That said I've found a few occurrences in the code where disabled was not accounted for. I've made those changes in this PR:

https://github.com/woocommerce/woocommerce/pull/44034

morv96 commented 9 months ago

FYI when i try to test it and see the ERROR i made clean, new WP installation, and face same error with theme: storefront so the issue is not cache as i didn't have any other plugin beside woocommerce and storefront theme. elses if it issue from "hostinger" hosting server...

also, i found that it not force as i told before when i disable shipping

Thanks for your help and fixing that bug

mikejolley commented 9 months ago

@morv96 could you provide the exact settings on this clean install you used and what you did as a customer on frontend (logged in or out etc)?

I will test them against the fixes I just merged.

yukikatayama commented 9 months ago

Similar report in 7650837-zen

nielslange commented 9 months ago

Hello @morv96 and @yukikatayama 👋

@opr just created a fix for this issue in #44388. We hope that the fix will be shipped with the next patch release, WooCommerce 8.5.3.

Meanwhile, could you try if the following workaround is working for you:

  1. Set this option: WooCommerce → Settings → Shipping location(s): Ship to specific countries only
  2. In the next box: Ship to specific countries set the countries you want to sell to.
  3. Save the settings.
  4.  Set this option: WooCommerce → Settings → Shipping location(s): Disable shipping & shipping calculations
  5. The countries you set in step 2 will now show in the billing form.
raifd commented 9 months ago

Reported here too: 7723266-zen

nielslange commented 9 months ago

Reported here too: 7723266-zen

@raifd Have you suggested the workaround as mentioned in https://github.com/woocommerce/woocommerce/issues/43853#issuecomment-1929599620?

ralucaStan commented 9 months ago

I am closing this as a fix for this will land this week in WooCommerce 8.6. Keep an eye on https://developer.woo.com/blog/ for the release announcement.

raifd commented 8 months ago

@nielslange looks like this got fixed with 8.6 but yes, the workaround was good to go for my case as well.

nielslange commented 8 months ago

I'm glad to hear that the issue is resolved with 8.6 and that the workaround was working as expected, @raifd.