This thread is resolved. Here is a description of the problem and solution.

Problem:

How to limit the WooCommerce checkout form to specific countries for each language?

Solution:

This is part of the solution for the issues that were presented in this thread.

You can try and use this custom code in the functions.php file of your theme.

function woo_override_checkout_fields_billing( $fields ) { 
    if(ICL_LANGUAGE_CODE=='tr'){
    $fields['billing']['billing_country'] = array(
        'type'      => 'select',
        'label'     => __('My New Country List', 'woocommerce'),
        'options'   => array('TR' => 'Turkey')
    );
    }
    elseif (ICL_LANGUAGE_CODE=='en'){
        $fields['billing']['billing_country'] = array(
            'type'      => 'select',
            'label'     => __('My New Country List', 'woocommerce'),
            'options'   => array('AU' => 'Australia')
        ); 
    }
    return $fields;
} 
add_filter( 'woocommerce_checkout_fields' , 'woo_override_checkout_fields_billing' );

Of cours, that this is an example and you will need to do some adjatments for this code to your case/countries.

Relevant Documentation:

This code is based on the information from the following links.

https://stackoverflow.com/questions/45385808/strict-to-1-country-only-in-checkout-page-with-wordpress-and-woocommerce

https://wpml.org/documentation/support/wpml-coding-api/

It is important to mention that since it is custom code and it involves a third party function (WooCommerce), we will not be able to support it or guarantee that it will work.

100% of people find this useful.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 15 replies, has 2 voices.

Last updated by Itamar 2 years, 7 months ago.

Assigned support staff: Itamar.

Author Posts
November 19, 2017 at 10:27 pm #1435210

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi, Baljot.

You are right unfortunately the code does not work.
The thing is that the original code, the one from this link (hidden link), does not work either.
Even without our suggested modification and if this code is added to the functions.php file of the theme, the countries list does not change.
I'm sorry but as I already mentioned these custom modifications relate to WooCommerce and not to WPML and out of the scope of this support forum.
If you are stuck then, please consider again getting professional help as I've already suggested here https://wpml.org/forums/topic/checkout-currency-and-countries-not-converting/#post-1416727.

Best regards,
Itamar.