Support

Home Forums Event Espresso Premium Change order of state/provinces optgroups on registration forms?

Change order of state/provinces optgroups on registration forms?

Posted: April 20, 2016 at 10:31 pm


richard sandilands

April 20, 2016 at 10:31 pm

Hi there

I’ve seen the support thread about changing the order of countries in the select dropdown menus, but want to also change the order of states/provinces in the corresponding dropdown.

Most of our customers are Australian, with some from New Zealand. But the states/provinces dropdown displays all the NZ provinces ahead of the Australian states.

I tried changing the order with jQuery thus:

add_action( 'wp_footer', 'my_custom_js_for_checkout' );
function my_custom_js_for_checkout() { 
// change slug on next line if your registration page has a different slug
if ( is_page( 'registration-checkout' ) ) { 
?>
<script>
jQuery(document).ready(function($){
	 var options = $('.ee-reg-qstn-state optgroup'); 
	$( options[ 1 ] ).insertAfter( $(options[ 0 ] ) );
});
</script>
<?php 
}
}

but didn’t get the result I needed.

Any clues on how to put the Australian states first would be appreciated.


Josh

  • Support Staff

April 21, 2016 at 11:57 am

Hi Richard,

Can you post a link to your site’s registration page so we can take a look for clues why the code you tried didn’t work?


richard sandilands

April 21, 2016 at 4:07 pm

Sure, you can access it after selecting a registration from this page:

https://bookings.byronclinic.com/events/cathy-malchiodi-sydney-2016/


Josh

  • Support Staff

May 4, 2016 at 9:36 am

Sorry for the delay. You can try this instead:

https://gist.github.com/joshfeck/c95b0a163c3d9c2c37c8e4d6efa47dcb

The support post ‘Change order of state/provinces optgroups on registration forms?’ 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.

Event Espresso