Fix suggestion to support locale in delivery api
-
Dear Javier,
I like your plugin too much
I’ve it used in one of my stores. Which include another locale than English. and an Aramex delivery plugin which is used to calculate shipping cost depend on city and country.
I found it useful to change these lines
foreach ( $dropdown_places as $city_name ) {
if(!is_array($city_name)) {
$field .= ‘<option value=”‘ . esc_attr( $city_name ) . ‘” ‘.selected( $value, $city_name, false ) . ‘>’ . $city_name .'</option>’;
}
}`
to
foreach ( $dropdown_places as $city_en_name => $city_name ) {
if(!is_array($city_name)) {
$field .= ‘<option value=”‘ . esc_attr( $city_en_name ) . ‘” ‘.selected( $value, $city_name, false ) . ‘>’ . $city_name .'</option>’;
}
}
Also, change the structure of places files using regexp to make it like this
global $places;global $places; $places['SA'] = array( // Riyadh Region 'SA-01' => array(
‘Afif’ => _x(‘Afif’, ‘Governorates of Saudi Arabia’, ‘states-cities-and-places-for-woocommerce’),
), ); // Use this filter to handle the Governorates of Saudi Arabia $places['SA'] = apply_filters('scpwoo_custom_places_sa', $places['SA']);
Which will allow Aramex / DHL or any other plugin that uses the original city name to have the ability to process it even if website have any un natural language
What do you think?
Please let me know
Thanks
- The topic ‘Fix suggestion to support locale in delivery api’ is closed to new replies.