8manos / wc-city-select

City Select for WooCommerce. Show a dropdown select as the cities input.
https://wordpress.org/plugins/wc-city-select/
33 stars 41 forks source link

how to apply filter #1

Closed abedfatafta closed 8 years ago

abedfatafta commented 8 years ago

Dear, after installaing , where and how to apply the filter ? could you please specify

Mantish commented 8 years ago

I've added some instructions, hopefully it's clear now

cristianciuberea commented 8 years ago

If i add the filter in the functiuons.php the drop down is not working anymore.

Also, don't know why, if i use your strucutre, and copy the code from the citi file in functions php, the dropdown is not showing :(

Mantish commented 8 years ago

@cristianciuberea can you share your code to see if there's something wrong?

cristianciuberea commented 8 years ago

sure, attached. thanks for help romanian_cities.txt

Mantish commented 8 years ago

@cristianciuberea it looks ok. did you add your country's states using woocommerce_states filter?

cristianciuberea commented 8 years ago

Yes, this is the code:

add_filter( 'woocommerce_states', 'custom_woocommerce_states' );

function custom_woocommerce_states( $states ) { $states['RO'] = array( 'AB' => 'Alba', 'AR' => 'Arad', 'AG' => 'Arges', 'BC' => 'Bacau', 'BH' => 'Bihor', 'BN' => 'Bistrita-Nasaud', 'BT' => 'Botosani', 'BV' => 'Brasov', 'BR' => 'Braila', 'B' => 'Bucuresti', 'BZ' => 'Buzau', 'CS' => 'Caras-Severin', 'CL' => 'Calarasi', 'CJ' => 'Cluj', 'CT' => 'Constanta', 'CV' => 'Covasna', 'DB' => 'Dambovita', 'DJ' => 'Dolj', 'GL' => 'Galati', 'GR' => 'Giurgiu', 'GJ' => 'Gorj', 'HR' => 'Harghita', 'HD' => 'Hunedoara', 'IL' => 'Ialomita', 'IS' => 'Iasi', 'IF' => 'Ilfov', 'MM' => 'Maramures', 'MH' => 'Mehedinti', 'MS' => 'Mures', 'NT' => 'Neamt', 'OT' => 'Olt', 'PH' => 'Prahova', 'SM' => 'Satu Mare', 'SJ' => 'Salaj', 'SB' => 'Sibiu', 'SV' => 'Suceava', 'TR' => 'Teleorman', 'TM' => 'Timis', 'TL' => 'Tulcea', 'VS' => 'Vaslui', 'VL' => 'Valcea', 'VN' => 'Vrancea' );

return $states; }

Mantish commented 8 years ago

it should be working. Is your site online so I can see it?

cristianciuberea commented 8 years ago

This is a test version http://myplayground.website/product/carte/. The Dropdown for cities doesnt work if i add that code in the functions only if i use the plugin

Mantish commented 8 years ago

are you sure the plugin is installed and active?

cristianciuberea commented 8 years ago

Do i need to have them both? the code with cities in functionts, and the plugin activated?

The idea is that the plugin is active, the delivery doesnt work ok. The cities are not recognized in the delivery sistem. So i wanted to try with code only, without plugin.

Can i do this? or the code in the romanian_cities.txt file work only with plugin activated?

Thanks for help

Mantish commented 8 years ago

The plugin has to be active. That's what makes it all work. I guess you'd have to check your delivery system. The only change made to the form is that the cities input is replaced for a select.