{"id":335519,"date":"2026-07-03T07:44:58","date_gmt":"2026-07-03T07:44:58","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/sri-lankan-cities-for-woocommerce\/"},"modified":"2026-07-03T07:44:44","modified_gmt":"2026-07-03T07:44:44","slug":"sl-cities-woo","status":"publish","type":"plugin","link":"https:\/\/wordpress.org\/plugins\/sl-cities-woo\/","author":15751343,"comment_status":"closed","ping_status":"closed","template":"","meta":{"version":"1.0.0","stable_tag":"1.0.0","tested":"7.0","requires":"6.5","requires_php":"7.4","requires_plugins":null,"header_name":"Sri Lankan Cities for WooCommerce","header_author":"Thushara","header_description":"Adds Sri Lanka's 25 districts to WooCommerce checkout, suggests cities for the chosen district, and autofills postal codes.","assets_banners_color":"9e3b59","last_updated":"2026-07-03 07:44:44","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"","header_author_uri":"https:\/\/profiles.wordpress.org\/lakshan12\/","rating":0,"author_block_rating":0,"active_installs":0,"downloads":37,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":{"1.0.0":{"tag":"1.0.0","author":"lakshan12","date":"2026-07-03 07:44:44"}},"upgrade_notice":{"1.0.0":"<p>If you used the old code-snippet version, remove the snippet before activating the plugin \u2014 both at once causes a duplicate-function error.<\/p>"},"ratings":[],"assets_icons":{"icon-128x128.png":{"filename":"icon-128x128.png","revision":3594909,"resolution":"128x128","location":"assets","locale":"","width":128,"height":128},"icon-256x256.png":{"filename":"icon-256x256.png","revision":3594909,"resolution":"256x256","location":"assets","locale":"","width":256,"height":256}},"assets_banners":{"banner-1544x500.png":{"filename":"banner-1544x500.png","revision":3594909,"resolution":"1544x500","location":"assets","locale":"","width":1544,"height":500},"banner-772x250.png":{"filename":"banner-772x250.png","revision":3594909,"resolution":"772x250","location":"assets","locale":"","width":772,"height":250}},"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0.0"],"block_files":[],"assets_screenshots":{"screenshot-1.png":{"filename":"screenshot-1.png","revision":3594909,"resolution":"1","location":"assets","locale":"","width":1280,"height":1000},"screenshot-2.png":{"filename":"screenshot-2.png","revision":3594909,"resolution":"2","location":"assets","locale":"","width":1280,"height":1000},"screenshot-3.png":{"filename":"screenshot-3.png","revision":3594909,"resolution":"3","location":"assets","locale":"","width":1280,"height":1100},"screenshot-4.png":{"filename":"screenshot-4.png","revision":3594909,"resolution":"4","location":"assets","locale":"","width":1280,"height":868}},"screenshots":{"1":"Classic checkout \u2014 the required District dropdown with all 25 Sri Lankan districts.","2":"Pick a known city and the postal code fills in automatically \u2014 shipping switches to the matching district zone.","3":"The block checkout is fully supported: district, city suggestions and postcode autofill.","4":"Ship by district \u2014 districts appear as regions in WooCommerce \u2192 Settings \u2192 Shipping."}},"plugin_section":[],"plugin_tags":[3148,6264,3522,74610,286],"plugin_category":[45],"plugin_contributors":[246643],"plugin_business_model":[],"class_list":["post-335519","plugin","type-plugin","status-publish","hentry","plugin_tags-checkout","plugin_tags-districts","plugin_tags-postcode","plugin_tags-sri-lanka","plugin_tags-woocommerce","plugin_category-ecommerce","plugin_contributors-lakshan12","plugin_committers-lakshan12"],"banners":{"banner":"https:\/\/ps.w.org\/sl-cities-woo\/assets\/banner-772x250.png?rev=3594909","banner_2x":"https:\/\/ps.w.org\/sl-cities-woo\/assets\/banner-1544x500.png?rev=3594909","banner_rtl":false,"banner_2x_rtl":false},"icons":{"svg":false,"icon":"https:\/\/ps.w.org\/sl-cities-woo\/assets\/icon-128x128.png?rev=3594909","icon_2x":"https:\/\/ps.w.org\/sl-cities-woo\/assets\/icon-256x256.png?rev=3594909","generated":false},"screenshots":[{"src":"https:\/\/ps.w.org\/sl-cities-woo\/assets\/screenshot-1.png?rev=3594909","caption":"Classic checkout \u2014 the required District dropdown with all 25 Sri Lankan districts."},{"src":"https:\/\/ps.w.org\/sl-cities-woo\/assets\/screenshot-2.png?rev=3594909","caption":"Pick a known city and the postal code fills in automatically \u2014 shipping switches to the matching district zone."},{"src":"https:\/\/ps.w.org\/sl-cities-woo\/assets\/screenshot-3.png?rev=3594909","caption":"The block checkout is fully supported: district, city suggestions and postcode autofill."},{"src":"https:\/\/ps.w.org\/sl-cities-woo\/assets\/screenshot-4.png?rev=3594909","caption":"Ship by district \u2014 districts appear as regions in WooCommerce \u2192 Settings \u2192 Shipping."}],"raw_content":"<!--section=description-->\n<p>WooCommerce ships Sri Lanka with no districts and the State field hidden. This plugin makes checkout work the way Sri Lankan addresses actually work: <em>101, Main Street, Negombo, Gampaha, 11500, Sri Lanka<\/em>.<\/p>\n\n<ul>\n<li>Adds all <strong>25 districts<\/strong> as a required <strong>District<\/strong> dropdown, keyed by ISO 3166-2:LK codes so couriers and shipping plugins interoperate.<\/li>\n<li>Suggests <strong>cities for the selected district<\/strong> while the customer types \u2014 288 verified cities across all 25 districts.<\/li>\n<li><strong>Autofills the postal code<\/strong> when a known city is picked \u2014 still editable, and it never overwrites a code the customer typed themselves.<\/li>\n<li>Lets you build <strong>district-based shipping zones<\/strong> (WooCommerce \u2192 Settings \u2192 Shipping \u2192 Add zone \u2192 pick districts).<\/li>\n<li>Works on <strong>both<\/strong> the classic (shortcode) checkout and the block checkout.<\/li>\n<\/ul>\n\n<h4>Safety and design<\/h4>\n\n<ul>\n<li><strong>No external services.<\/strong> No data leaves your site, nothing is tracked, no account is needed.<\/li>\n<li>No AJAX endpoints, no database writes, no extra checkout fields \u2014 WooCommerce validates the district server-side automatically.<\/li>\n<li>Everything fails safe: without WooCommerce the plugin does nothing; with JavaScript blocked, the district dropdown still works and city\/postcode are normal manual fields.<\/li>\n<li>Block-checkout updates go through WooCommerce's official wp.data store API.<\/li>\n<\/ul>\n\n<h4>Data provenance<\/h4>\n\n<p>Every autofilled postal code was verified against Sri Lanka Post and independent directories (July 2026). Cities whose codes could not be fully verified are left out \u2014 for those, the city field simply works as a plain text box.<\/p>\n\n<!--section=installation-->\n<ol>\n<li>Install and activate from Plugins \u2192 Add New Plugin (or upload the zip via Upload Plugin).<\/li>\n<li>WooCommerce 8.9 or newer must be active.<\/li>\n<li>Done \u2014 districts, city suggestions and postcode autofill work immediately on checkout. The plugin has no settings page of its own; the <strong>Settings<\/strong> link on the Plugins screen takes you to WooCommerce's shipping settings, where the districts appear as zone regions.<\/li>\n<\/ol>\n\n<p><strong>Upgrading from the code-snippet version:<\/strong> if you previously installed this as a snippet (FluentSnippets, a child theme's functions.php, or an mu-plugin file), remove that copy BEFORE activating the plugin. Both loaded at once causes a duplicate-function PHP error.<\/p>\n\n<!--section=faq-->\n<dl>\n<dt id=\"how%20do%20i%20add%20my%20own%20cities%3F\"><h3>How do I add my own cities?<\/h3><\/dt>\n<dd><p>Use the <code>slwc_city_data<\/code> filter from your child theme or a small snippet:<\/p>\n\n<pre><code>add_filter( 'slwc_city_data', function ( $data ) {\n    $data['LK-12']['My Village'] = '11123'; \/\/ district code =&gt; city =&gt; postcode\n    return $data;\n} );\n<\/code><\/pre>\n\n<p>District keys are ISO 3166-2:LK codes (the full list is in the District dropdown at checkout). Keep postcodes as quoted 5-digit strings \u2014 leading zeros matter.<\/p><\/dd>\n<dt id=\"does%20it%20work%20with%20the%20block%20checkout%3F\"><h3>Does it work with the block checkout?<\/h3><\/dt>\n<dd><p>Yes. Both the classic shortcode checkout and the block checkout are supported; block updates go through WooCommerce's official wp.data store API.<\/p><\/dd>\n<dt id=\"what%20if%20a%20customer%27s%20city%20is%20not%20in%20the%20list%3F\"><h3>What if a customer's city is not in the list?<\/h3><\/dt>\n<dd><p>Nothing breaks: the city field keeps working as a normal text box and the customer types their postcode manually.<\/p><\/dd>\n<dt id=\"can%20i%20ship%20by%20district%3F\"><h3>Can I ship by district?<\/h3><\/dt>\n<dd><p>Yes \u2014 the districts appear as regions in WooCommerce \u2192 Settings \u2192 Shipping \u2192 Add zone, so you can price shipping per district.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>1.0.0<\/h4>\n\n<ul>\n<li>Initial release: 25 districts at checkout, 288-city suggestions, postcode autofill, district shipping zones, classic + block checkout.<\/li>\n<\/ul>","raw_excerpt":"Adds Sri Lanka&#039;s 25 districts to WooCommerce checkout, suggests cities for the chosen district, and autofills postal codes.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/335519","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=335519"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/lakshan12"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=335519"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=335519"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=335519"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=335519"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=335519"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=335519"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}