=== Colciudades - Ciudades de Colombia para WooCommerce ===
Contributors: davidzoque
Tags: colombia, block checkout, shipping, cities
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.4
Requires Plugins: woocommerce
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

City dropdown by department for the WooCommerce block and classic checkout, plus per-city shipping. Built for Colombia.

== Description ==

**Works in the block checkout and in the classic one.** WooCommerce shows Colombia's 33 departments at checkout, but the City field is left as free text. Most plugins only turn it into a dependent dropdown in the classic checkout; this one also does it in the new **block checkout** (the React based one), and it adds per-city shipping.

* City dropdown that depends on the selected department, in the WooCommerce **block checkout** and the **classic checkout** (shipping and billing addresses).
* In classic stores it also works in My Account > Addresses and in the cart shipping calculator, with a search box.
* Adds a **per-city shipping method** (based on flat rate): pick the cities and a cost inside a zone, with an option to hide the other methods when it applies. The city selector is a search box.
* Bundles Colombia's **1,104 official municipalities** (DANE), with correct accents.
* Uses WooCommerce's native departments (ISO 3166-2). **No other plugin required.**
* Saves the value in the standard `city` field, so shipping, taxes and the invoice get it unchanged.
* Compatible with HPOS and the cart/checkout blocks. Translation ready, with Spanish included.

== Installation ==

Upload the `colciudades` folder to `/wp-content/plugins/` (or install the ZIP from Plugins > Add New > Upload Plugin), then activate it. Make sure WooCommerce is active. It works with the block Checkout and with the classic one. For per-city shipping, go to WooCommerce > Settings > Shipping, add the "Shipping by city (Colombia)" method to a zone, and pick the cities and the cost.

== Frequently Asked Questions ==

= Do I need another "Colombia departments and cities" plugin? =

No. It uses WooCommerce's own departments plus its own municipality list and its own per-city shipping.

= Does it work in the classic checkout? =

Yes. In the classic checkout, My Account > Addresses and the cart shipping calculator the City field becomes a searchable dropdown, like the Department field. The per-city shipping method works in both checkouts, because it is a standard WooCommerce shipping method.

= A customer's town is not in the list =

The list has the official DANE municipalities. You can add values with the `colciu_ciudades` filter.

== Screenshots ==

1. The City field turned into a department-dependent dropdown in the block checkout.
2. The "Shipping by city (Colombia)" method with the searchable city selector and the cost.

== Changelog ==

= 1.0.4 =
* Hardening after a security review: the city list for the shipping method is only built for users who can manage WooCommerce, and the city data printed on the checkout is encoded so that no name can ever close the script tag.
* Fix: a shipping cost typed with a backslash lost it, because the value was unslashed once more than WooCommerce does.

= 1.0.3 =
* Renamed to "Colciudades - Ciudades de Colombia para WooCommerce".
* New: the city dropdown now also works in the classic checkout, My Account > Addresses and the classic cart shipping calculator, as a search box like the Department field.
* For Colombia, Department now comes before City in the address forms (classic and block), so the city list matches the chosen department.
* Per-city shipping now matches cities ignoring accents and case, so a city typed as "medellin" (block cart shipping calculator, addresses saved before the plugin) matches "Medellín".
* Saved addresses whose city lacks accents are now recognised in the dropdown instead of being cleared.
* "Single method" also works when the city list is empty (whole department), and it only hides other methods in the package where this method applies.
* The hidden original City input no longer takes keyboard focus.
* The checkout script stops looking for the block checkout after 30 seconds on pages that do not use it.

= 1.0.2 =
* Fix: on stores whose thousand separator is a dot (e.g. COP), the per-city shipping cost could lose its thousands when saved (50.000 became 50). WooCommerce 11 shows the localised value in the settings modal but only de-localises its own flat rate fields on save; the cost is now interpreted using the store's separators. Cost formulas keep working as before.

= 1.0.1 =
* City label position fix on some themes.
* Per-city shipping method with a searchable city selector, and support for country-level zones.
* Translation ready, with Spanish included.

= 1.0.0 =
* Initial release: department-dependent city dropdown in the block checkout, and per-city shipping method.

== Upgrade Notice ==

= 1.0.4 =
Hardening after a security review. No known vulnerability is fixed; updating is recommended but not urgent.

= 1.0.3 =
City dropdown in the classic checkout too, and per-city shipping that matches cities typed without accents.

= 1.0.2 =
Important fix for stores using a dot as thousand separator (e.g. COP): the per-city shipping cost no longer loses its thousands when saved with WooCommerce 11.

= 1.0.1 =
Searchable city selector and per-city shipping improvements.

== Credits ==

The municipality list is built from the open-source "colombia-json" dataset by Marco Vega (https://github.com/marcovega/colombia-json), available under the MIT license, based on official DANE (public domain) data.
