Rise Company
15-03-2022, 02:20
ووردبريس WordPress ووكومرس WooCommerce قائمة المدن Cities drop down
3 Level WooCommerce States & Cities drop down - Plugin Development in WordPress
How to add custom country in WooCommerce - How to add city and districts in WooCommerce
Replace the city text field by a dropdown of cities for a specific country in Woocommerce
Add dropdown list of cities in Woocommerce checkout page
Aramex: ERR52 - Destination Address - City name is invalid (s)
https://youtu.be/yGhB5zRXUos
الروابط
https://github.com/YTTechiePress/states-and-cities-for-woocommerce/blob/main/states-and-cities-for-wocoommerce.php
https://github.com/woocommerce/woocommerce/blob/master/i18n/countries.php
https://github.com/woocommerce/woocommerce/blob/master/i18n/states.php
In some specific cases, you might need to change the WooCommerce default country, state or region to better suit your needs. For example, if you are creating a city-specific service that delivers the orders only inside the city boundaries.
Woocommerce comes with the predefined country list as well as the states and regions. However, this list is not so accurate as you might need to limit the shipping zone to the city districts or municipalities.
The code need to be added in your theme's function.php file. There is no problems with this answer code as it's fully tested and works. You can also use the Code Snippets plugin (https://wordpress.org/plugins/code-snippets/) that woocommerce recommend. Using the theme editor is not recommended. You should use an external editor linked to your FTP software.
// Copy from here
/**
* Change the checkout city field to a dropdown field.
*/
function jeroen_sormani_change_city_to_dropdown( $fields ) {
$city_args = wp_parse_args( array(
'type' => 'select',
'options' => array(
'alexandria' => 'Alexandria',
'Awaied-Ras Souda' => 'Awaied-Ras Souda',
'Borg Al Arab City' => 'Borg Al Arab City',
'Sedi Kreir' => 'Sedi Kreir',
'Atfeah' => 'Atfeah',
'Badrashin' => 'Badrashin',
),
'input_class' => array(
'wc-enhanced-select',
)
), $fields['shipping']['shipping_city'] );
$fields['shipping']['shipping_city'] = $city_args;
$fields['billing']['billing_city'] = $city_args; // Also change for billing field
wc_enqueue_js( "
jQuery( ':input.wc-enhanced-select' ).filter( ':not(.enhanced)' ).each( function() {
var select2_args = { minimumResultsForSearch: 5 };
jQuery( this ).select2( select2_args ).addClass( 'enhanced' );
});" );
return $fields;
}
add_filter( 'woocommerce_checkout_fields', 'jeroen_sormani_change_city_to_dropdown' );
ضع الكود داخل functions.php فى theme child او ضعها فى Code Snippets plugin (https://wordpress.org/plugins/code-snippets/)
الكود فى الاعلى كل ما عليك فعله هو وضع city بداخلها
بالترتيب الى تريده مع القيمة ويقابلها اللغة
ملحوظة :
اهمية عمل ذلك هو ان اراميكس لها توزيعة محددة فى حساب shipping
يتطلب ان يكون cities الخاصة بها موجودة كاختيار select لان البديل
هيكون العميل يكتب text اسم city والتى يجب ان تكون متطابقة تماما مع aramex
وحرف زائد او مسافة زائدة هيجب rate calculate يكون خطا
Aramex: ERR52 - Destination Address - City name is invalid (s)
فى المرفقات ملف أرامكس بالتقسيم المعتمد لهم
المرجع:
https://silvawebdesigns.com/how-to-change-the-city-field-to-a-dropdown-in-woocommerce/
https://stackoverflow.com/questions/47013836/add-dropdown-list-of-cities-in-woocommerce-checkout-page
https://stackoverflow.com/questions/52605635/replace-the-city-text-field-by-a-dropdown-of-cities-for-a-specific-country-in-wo
https://stackoverflow.com/questions/61896219/aramex-plugin-errors
https://wordathemes.com/add-city-and-district-for-shipping-zones-in-woocommerce/
https://aceplugins.com/how-to-make-the-customer-city-field-a-dropdown/
https://xtemos.com/forums/topic/dropdown-for-woocommerce-checkout/
3 Level WooCommerce States & Cities drop down - Plugin Development in WordPress
How to add custom country in WooCommerce - How to add city and districts in WooCommerce
Replace the city text field by a dropdown of cities for a specific country in Woocommerce
Add dropdown list of cities in Woocommerce checkout page
Aramex: ERR52 - Destination Address - City name is invalid (s)
https://youtu.be/yGhB5zRXUos
الروابط
https://github.com/YTTechiePress/states-and-cities-for-woocommerce/blob/main/states-and-cities-for-wocoommerce.php
https://github.com/woocommerce/woocommerce/blob/master/i18n/countries.php
https://github.com/woocommerce/woocommerce/blob/master/i18n/states.php
In some specific cases, you might need to change the WooCommerce default country, state or region to better suit your needs. For example, if you are creating a city-specific service that delivers the orders only inside the city boundaries.
Woocommerce comes with the predefined country list as well as the states and regions. However, this list is not so accurate as you might need to limit the shipping zone to the city districts or municipalities.
The code need to be added in your theme's function.php file. There is no problems with this answer code as it's fully tested and works. You can also use the Code Snippets plugin (https://wordpress.org/plugins/code-snippets/) that woocommerce recommend. Using the theme editor is not recommended. You should use an external editor linked to your FTP software.
// Copy from here
/**
* Change the checkout city field to a dropdown field.
*/
function jeroen_sormani_change_city_to_dropdown( $fields ) {
$city_args = wp_parse_args( array(
'type' => 'select',
'options' => array(
'alexandria' => 'Alexandria',
'Awaied-Ras Souda' => 'Awaied-Ras Souda',
'Borg Al Arab City' => 'Borg Al Arab City',
'Sedi Kreir' => 'Sedi Kreir',
'Atfeah' => 'Atfeah',
'Badrashin' => 'Badrashin',
),
'input_class' => array(
'wc-enhanced-select',
)
), $fields['shipping']['shipping_city'] );
$fields['shipping']['shipping_city'] = $city_args;
$fields['billing']['billing_city'] = $city_args; // Also change for billing field
wc_enqueue_js( "
jQuery( ':input.wc-enhanced-select' ).filter( ':not(.enhanced)' ).each( function() {
var select2_args = { minimumResultsForSearch: 5 };
jQuery( this ).select2( select2_args ).addClass( 'enhanced' );
});" );
return $fields;
}
add_filter( 'woocommerce_checkout_fields', 'jeroen_sormani_change_city_to_dropdown' );
ضع الكود داخل functions.php فى theme child او ضعها فى Code Snippets plugin (https://wordpress.org/plugins/code-snippets/)
الكود فى الاعلى كل ما عليك فعله هو وضع city بداخلها
بالترتيب الى تريده مع القيمة ويقابلها اللغة
ملحوظة :
اهمية عمل ذلك هو ان اراميكس لها توزيعة محددة فى حساب shipping
يتطلب ان يكون cities الخاصة بها موجودة كاختيار select لان البديل
هيكون العميل يكتب text اسم city والتى يجب ان تكون متطابقة تماما مع aramex
وحرف زائد او مسافة زائدة هيجب rate calculate يكون خطا
Aramex: ERR52 - Destination Address - City name is invalid (s)
فى المرفقات ملف أرامكس بالتقسيم المعتمد لهم
المرجع:
https://silvawebdesigns.com/how-to-change-the-city-field-to-a-dropdown-in-woocommerce/
https://stackoverflow.com/questions/47013836/add-dropdown-list-of-cities-in-woocommerce-checkout-page
https://stackoverflow.com/questions/52605635/replace-the-city-text-field-by-a-dropdown-of-cities-for-a-specific-country-in-wo
https://stackoverflow.com/questions/61896219/aramex-plugin-errors
https://wordathemes.com/add-city-and-district-for-shipping-zones-in-woocommerce/
https://aceplugins.com/how-to-make-the-customer-city-field-a-dropdown/
https://xtemos.com/forums/topic/dropdown-for-woocommerce-checkout/