Updating Additional fields select type options overrides previous options
-
There’s a bug where adding Additional fields select options will overwrite previous options instead of adding new ones.
Repo Steps:
- On the dashboard, go to WooCommerce->Checkout
- Go to the “additional” tab.
- Click on “+ Add New Field”
- Under Type, select “Select”
- Under options, add three options. ‘a’, ‘b’, and ‘c’.
- Select the checbox next to option ‘b’.
- Click ‘Delete Selected’.
- Add one new option, ‘d’.
- Click Save.
Expected:
Options a, c, and d to be presented as optionsActual:
Options a and d are the only two options.What’s happening is internally the options are indexed 0, 1, 2, etc. but if you delete option 1, you’re left with 0 and 2. But if you create a new option, it creates it as index 2, which already exists, and overwrites the previous #2 when you save. It should create the new option as either #3 (the next highest) or #1 (to fill in the ‘missing’ #1).
This also happens with radio options. Probably any type that uses a list. They all seem to create the newest index the same way.
- The topic ‘Updating Additional fields select type options overrides previous options’ is closed to new replies.