Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multilingual WooCommerce issue #37

Open
Abdalsalaam opened this issue May 16, 2020 · 1 comment
Open

Multilingual WooCommerce issue #37

Abdalsalaam opened this issue May 16, 2020 · 1 comment

Comments

@Abdalsalaam
Copy link

Hi,
I'm using wc-city-select on multilingual WooCommerce website.

The issue is while user ordered, city will stored in the user language, and it will cause some issues with shipping plugins, city should be always English.

I tried to solve it by editing this :
foreach ( $this->dropdown_cities as $city_name ) { $field .= '<option value="' . $city_name. '" '.selected( $value, $city_name, false ) . '>' . $city_name .'</option>'; }

and replace it with:
foreach ( $this->dropdown_cities as $index => $city_name ) { $field .= '<option value="' . $index . '" '.selected( $value, $city_name, false ) . '>' . $city_name .'</option>'; }

and another edit on the cities array :
$cities['SA'] = array( 'Riyadh' => array( 'Riyadh' => __('Riyadh','wc_cities_p'), ));

by this way, index will be always in English language, and city will be compatible with WPML..etc

But, it actually didn't work because the first section does not appear on the HTML, I mean the billing_city or shipping_city select element always showing the original one.

where can I find this elements loop to edit it?

@Mantish
Copy link
Member

Mantish commented May 30, 2020

hey, I think I get what you mean, but I'm not sure what loop you're asking about...
Take a look here: https://github.com/8manos/wc-city-select/blob/master/assets/js/city-select.js#L166
The plugin uses javascript to change the list of cities according to the country/state selected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants