Posted: April 24, 2023 at 3:25 pm
I’ve reached out about this issue each year to see if you have found a solution to the fact that when using a Apple device and choosing the country, it does not show only the states for that country. Have you found a solution? Is there a way to set a default country and state? That would help for our local customers who have to scroll through hundreds of states before they get to the US states at the bottom of the list. I have looked for a setting to set defaults for state and country and have not found any. |
|
Hi there, My apologies for missing this thread previously. The only way we to set the default country currently is using a custom snippet to do it via JS, something like this: https://gist.github.com/Pebblo/f6d51d80506130c1a5780f49b9cb3c14 You ‘can’ also set a default state from within that code if required but try adding the above to a custom functions plugin first to see it works for you as is. https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/ |
|
Thanks. I will look into those. |
|
I’m not comfortable creating a plugin so I thought I would add the script to the child theme for the website in the functions.php file. I first added the script to make US the country default, and it worked. I then modified the country script to use for the default state, Illinois, and tried the val to “IL” and “Illinois” but that didn’t work. I’m assuming I need to modify the code further but don’t know where. Any insight? Here’s what I tried for the default state: add_action( |
|
For state you’ll need the ID, can you link me to an event I can run a test registration on to view the form? |
|
Yes, I will put a link to an event in a private reply. |
|
This reply has been marked as private. | |
Thats the registration ID and is unique for each registration. You need the ID of the state, so this: https://monosnap.com/file/KwNF5Kkhy3LOqBsJQvY5HfX7L2DqeV I’ve added another snippet to that gist here: That new gist sets both the country and state. |
|
That worked! Thank you! |
|
You’re most welcome. |
|
The support post ‘State Dropdown on Apple Mobile Devices’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.