Manage your custom states, cities, and postcodes by countries from a .json file that can be moved from the plugin to your custom location.
Available into My account, Shipping calculator form, and the Checkout.
Features And Options:
- Multicountry compatible.
- Postcode loaded from the selected location.
- Filters and actions are available.
- Also available for admin orders edition
- Upload the plugin files to the
/wp-content/plugins/wc-prov-cant-distdirectory, or install the plugin through the WordPress plugins screen directly.
- Activate the plugin through the ‘Plugins’ screen in WordPress.
- Optional, go to the settings page from plugin listing with Settings link or go to Menu > Settings > WC Provincia-Canton-Distrito
How do I set up the plugin?
No configuration required. All locations are automatically loaded to state, city, and postcode fields. However, it has three optional configurations: The first one removes the plugin priority for fields state, city, and postcode and keeps using the WooCommerce priority. The second one hides the postcode on the Checkout page, shipping calculator form, and billing and shipping form pages. And the last one allows you to debug the js plugin file printing the .js instead of .min.js.
Where is the data origin?
The distribution of Country > State > City-District > Postcode is loaded from a .json file located on /assets/js/prov-cant-dist.json.
Is it possible to override the data origin?
Yes, it can be overridden from your custom theme directory using the filter wcpcd_prov_cant_dist_json.
Is it possible to make it compatible with another country?
Now it is possible, simply override the prov-cant-dist.json file in your custom theme. Then you can add your country (based on WC country code) followed by states, cities-districts and postcodes. Use the filter
wcpcd_prov_cant_dist_jsonand the snippet from this gist
Having problems with the data origin (locations)?
You can check if the file with locations is being loaded to your site, simply go to the section
Testing JSON of Locationsin the settings page of the plugin. If there are problems loading this file, a message will be shown and with the instructions and the snippet required to load the locations from your custom theme. If the problem persists, send me an email using the
Contributors & Developers
“WC Provincia Canton Distrito” is open source software. The following people have contributed to this plugin.Contributors
- Update: Check for compatibility
- New: Setting for selecting an empty City-District after Province is selected
- New: Setting for loading the locations from plugin options
- Review: Check for compatibility with WP 6.0 and WC 6.6.1
- Fix: WC verification message that broke the initialization of the plugin
- Fix: Function wp_remote_fopen replaced by wp_safe_remote_get to disable de ssl verify.
- Fix: JS required validation for City-District field.
- New: Custom option to set an empty option to province to force customers to choose a province.
- Improvement: Code readability
- Remove: Options to set CR country as default after plugin activation
- Revision: Compatibility with WP and WC
- Improvement: Initialize JS for specific themes that includes a div after of p.form-row.
- Fix: Prevent JS error if locations are not loading to the site.
- Improvement: Helper message and snippet added to the settings page if locations file is not being loaded to the site.
- Fix: Undefined variable on the WP admin.
- Improvement: js trigger wcpcd_postcode with new parameters
- Fix: validation to load location data on admin new order page
- New: JS trigger wcpcd_postcode after postcode (Canton/Distrito) is selected
- Improvement: Validation to load location data only on orders admin page
- Improvement: .pot file
- Fix: include_once instead of include for admin option in includes/wcpcd-class.php.
- Improvement: JS validation for selected Country/State/City in prov-cant-dist.js. Reported using theme stephanie-king.
- New: Settings options separated to includes/admin/wcpcd-settings.php file
- New: Testing JSON file locations in settings page
- Review: WC 4.3.1 compatibility
- Update: Filter wcpcd_city_field_placeholder in city_first_option in includes/wcpcd-class.php
- New: JS to enable provincia-canton-distrito-zipcode to admin order panel
- New: Admin order options in includes/wcpcd-admin.php
- New: Provincia, Cant. y Dist. for manual orders created
- Fix: JS functions and performance
- Update: Main json format using country key
- New: Compatibility with multi countries from .json and .js
- Move to EN lang
- URGENT Fix: Validation for deprecated function wpcd_get_provincias
- Update: Validation compatibility for WP 5.4 and WC 4.0.x
- Fix update
- Remove: WPCD_TEXTDOMAIN
- New: .pot file
- New: en_US translation
- Update: Prefix wpcd_ to wcpcd_
- Update: WC compatibility
- New: WPCD_TEXTDOMAIN
- New: Empty index.php to the plugin
- Update: Custom css class .hide-zipcode to hide zipcode in the Checkout
- New: Hook to wp_head to add custom styles to hide zipcode fields
- Remove: Action woocommerce_before_shipping_calculator to the method wpcd_shipping_calculator_styles
- New: Action and method wpcd_locations_allowed to check for valid locations for the plugin
- Fix: wpcd_file_exists now uses wp_remote_fopen to get data from json file
- New filter wpcd_prov_cant_dist_json to load json data file
- Trigger to update_checkout after city change
- Update in function wpcd_get_provincia_canton_distrito to eliminate file_get_contents function
- Update domain name in class wpcd-class.php
- Latest stable version