2
votes

I am a little confused at the moment, I have added a custom dropdown menu into the checkout successfully, that pulls options from a custom post type. Now there are over 10k options, so I would like to somehow integrate the Select2 functionality to the dropdown select menu.

I have tried copying the class from the Country selector, but that does not work.

I am trying to make the select look exactly like - "Dropdown" top left on here: http://phppoet.com/checkout-fields/?page_id=6

I have looked all over to find any information on how to do this, and I have not found a single bit of info. Anyone have any clues?

Thanks

James

1
If you have the dropdown in place, then you need to initialize Select2. What part are you struggling with? I don't want to sound like an ass, but have you reviewed the Select 2 examples?helgatheviking

1 Answers

3
votes

So after a day of tinkering with this and looking at the select2 documents, I have finally managed to get this to work.

Basically the select2 code in the standard WooCommerce is an older version. I used the ajax query to pull search terms back from Wordpress after the user enters at least 4 digits.

I had to unregister the standard installed select2 and initiate the latest version of select2.