Dynamic Country-State-City Dependent Dropdown fields
This document provides the code needed to populate your custom callback dropdowns, which can be integrated with the Country, State, and City Dropdown fields. We strongly recommend reading this article beforehand to gain a comprehensive understanding of the choices callback feature.
To begin, you should add the provided code snippet located at the end of this article to your theme's functions.php file or utilize the Code Snippets plugin.
Custom Country Dropdown Field Settings
In your custom country dropdown field setting, paste in the Choices Callback option the function name um_customcb_populate_countries
into the field's "Choices Callback" setting.
Custom State Dropdown Field Settings
In your custom state dropdown field setting, paste in the Choices Callback option the function name um_customcb_populate_states
into the field's "Choices Callback" setting. Select the country field in the Parent Option setting to link these fields.
Custom City Dropdown Field Settings
In your custom city dropdown field setting, paste in the Choices Callback option the function name um_customcb_populate_city
into the field's "Choices Callback" setting. Select the state field in the Parent Option setting to link these fields.
WARNING: We have created this code example to provide guidance and to make it easier for you to implement this code into your website. However, we are not able to provide any support when it comes to customizing the plugin. If you need help implementing this code, please hire a developer.
Note: You can add the code snippet to your theme's functions.php file or use the Code Snippets plugin.