Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Feature Request › Ship by City
- This topic has 3 replies, 2 voices, and was last updated 6 years ago by Sayan Naskar.
- AuthorPosts
- November 25, 2018 at 12:46 pm #37979MustafaParticipant
Hi,
I have installed ( https://wordpress.org/plugins/wc-city-select/ ) And added the following filter to child theme function.php
add_filter(‘wcfmmp_city_select_dropdown_enabled’, ‘__return_true’ );I have added states like below and it’s working fine
[code]
add_filter( ‘woocommerce_states’, ‘custom_woocommerce_states’ );
function custom_woocommerce_states( $states ) {
$states[‘US’] = array(
‘Eastern’ => ‘Eastern’
);
return $states;
}
[/code]But why cities are not showing up when I added this code?
[code]
add_filter( ‘wc_city_select_cities’, ‘my_cities’ );
function my_cities( $cities ) {
$cities[‘US’] = array(
‘New York’,
‘Phoenix’
);
return $cities;
}
[/code] - November 26, 2018 at 9:43 am #38083Sayan NaskarMember
Hello,
Group the cities with their respective states. Use the code below
add_filter( 'wc_city_select_cities', 'my_cities' );
/**
* Replace XX with the country code. Instead of YYY, ZZZ use actual state codes.
*/
function my_cities( $cities ) {
$cities['XX'] = array(
'YYY' => array(
'City ',
'Another City'
),
'ZZZ' => array(
'City 3',
'City 4'
)
);
return $cities;
}
But please note that in WCfMMP Shipping by city restriction will only work in “Shipping by Zone” not in “Shipping by Country” or “Shipping by Weight”
- November 27, 2018 at 11:06 am #38343MustafaParticipant
Thank you, it is working now.
But why it won’t work in “Shipping by Country” or “Shipping by Weight” ?
- November 27, 2018 at 1:26 pm #38347Sayan NaskarMember
Hello,
Actually shipping “Shipping by Country” and “Shipping by Weight” works much differently than “Shipping by Zone”
Shipping by Zone supports multiple shipping methods in each zone which is not the case for others. They set a single cost for each matching country.Though we will plan some workaround to this in future updates for “Shipping by Country”.
Thank You.
- AuthorPosts
- The topic ‘Ship by City’ is closed to new replies.