Home › Forums › WoodMart support forum › Moving from porto to woodmart › Reply To: Moving from porto to woodmart
alexisrael
But those are universal cods that I used in function.php file.
for example this standard code from stackoverfllow that I used in the same site, does not work in woodmart:
I just want to create a dropdown city list:
this is the code:
// 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 ) {
global $woocommerce;
// Define here in the array your desired cities (Here an example of cities)
$option_cities = array(
“city1″=>”city1”,
“city2″=>”city2”,
“city3″=>”city3”
);
$country = $woocommerce->customer->get_shipping_country();
if ($country == ‘SA’){
$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;
} else{
$fields[‘billing’][‘billing_city’][‘type’] = ‘text’;
$fields[‘shipping’][‘shipping_city’][‘type’] = ‘text’;
}
return $fields;
}
What is wrong?