• Resolved milka21

    (@milka21)


    I’m experiencing an issue with country sorting in WooCommerce. When the site’s primary language is set to English, countries are sorted alphabetically. However, when switching to other languages (e.g.Estonian, Latvian), the sorting does not follow the correct alphabetical order but instead inherits the English order.

    Setup details: No active plugins except WooCommerce

    What I’ve tried:

    • Using woocommerce_countries filter to sort the countries manually.
    • Setting locale with setlocale(LC_COLLATE, $locale).
    • Clearing WooCommerce cache and site transients.

    None of these solutions have worked. It seems that WooCommerce forces the English sorting order even when a different language is selected.

    Expected behavior: Countries should be sorted alphabetically based on the selected language.

    Current behavior: Countries appear in the same order as in English, even when using a different language.

    Is this a known issue, or is there another way to enforce proper alphabetical sorting in different languages?

    I’ve checked several other multilingual websites, and they all have the same issue. It seems to affect everyone using a language other than English.

    Thanks in advance for your help!

    Mila

Viewing 1 replies (of 1 total)
  • Plugin Support shahzeen(woo-hc)

    (@shahzeenfarooq)

    Hi there!

    Thank you for reaching out and for the detailed explanation of your issue.

    WooCommerce sorts countries alphabetically based on their English names by default. However, when switching to other languages, the sorting may not automatically adjust due to how WooCommerce handles country lists internally.

    To change the country order according to the site language, customization is required, which is outside our scope of support. If you need more in-depth support or want to consider professional assistance for customization, I can recommend WooExperts and Codeable.io as options for getting professional help. Alternatively, you can also ask your development questions in the  WooCommerce Community Slack as custom code falls outside our usual scope of support.

Viewing 1 replies (of 1 total)

The topic ‘Country Sorting Not Alphabetical in WooCommerce’ is closed to new replies.