I just discovered that even WOO has issues keeping product items in selected order with the new select2 script.

F.e. select 3 upsells in random order and save the product. Now you want the middle upsell product to be last in order. Delete the middle one from the upsell products and select it again. One would expect that it will be added last to the item list of selected upsell products but it will go back to the middle position. If however you save the product first after deleting the middle one then go back to the upsell products field and add the deleted upsell product back in again it will be added at the end of the selected products and you have it at the correct location. Very cumbersome !

This is caused by the new select2 script. In the old version it was just added ad the end of the selected items and no need for a extra save of the product.

This was never a issue in the pre woo v 3.0 versions. By changing the select2 script of which its developers say that it is a mayor and better update they wrecked that nice ability to keep the selected order. Regardless the threads on github pointing this out they never cared about providing a solution from within the script itself. One would normally think that when a script evolves it becomes better and old abilities are enhanced. They just killed the best ability that script had.

Also if you dont grab your items from the database but use a predefined ul li list with all the elements that can be selected. First of all one has to use some fixed code to keep the order of the items that are selected so they dont sort in the order of the selectable items. But when reading back the selected items, after a selection has been made, they are sorted the way they appear in the list of selectable items. Now one has to pre-sort that list of selectable items in the order of the items that are selected to keep the latter in the correct order. This is utterly stupid.

But by sorting the predefined list of selectable items to keep the selected items in the correct order you loose the ability of having the items that can be selected in a nice alphabetical order.

In short i can understand why developers kept the old select2 script running. And now Woo crashed that ability.