Home Forums WoodMart support forum Moving from porto to woodmart Reply To: Moving from porto to woodmart

#527460

Hello,

Please Try to add the below code to functions.php in the Child theme

// Change "city" checkout billing and shipping fields to a dropdown
 add_filter( 'woocommerce_checkout_fields' , 'override_checkout_city_fields' ); function override_checkout_city_fields( $fields ) { 
// Define here in the array your desired cities (Here an example of cities) 
$option_cities = array( '' => __( 'Select your city' ), 'Karachi' => 'Karachi', 'Lahore' => 'Lahore', 'Faisalabad' => 'Faisalabad', 'Rawalpindi' => 'Rawalpindi', 'Gujranwala' => 'Gujranwala', 'Peshawar' => 'Peshawar', 'Multan' => 'Multan', 'Hyderabad' => 'Hyderabad', 'Islamabad' => 'Islamabad' ); $fields['billing']['billing_city']['type'] = 'select'; $fields['billing']['billing_city']['options'] = $option_cities; $fields['shipping']['shipping_city']['type'] = 'select'; $fields['shipping']['shipping_city']['options'] = $option_cities; return $fields; }

Best Regards.