-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Select2 fields not working in 3.0.x
If you see something like this on product and coupon edit pages you may have a Select2 conflict or JavaScript error:
WooCommerce 3.0 updated the Select2 library to v4 which is not backwards compatible with v3. See this post.
You may also see an error like this in your JavaScript error console:
Error: Option ‘ajax’ is not allowed for Select2
- A generic JavaScript error stopping scripts from running.
- A plugin/theme loading v3 Select2 globally on all admin pages, including WooCommerce pages
- A WooCommerce extension that has not been updated following these instructions.
JavaScript errors can be looked up in the console. To do this, in Chrome browser, go to View > Developer > JavaScript console
.
A panel will open up at the bottom of the screen. Refresh the page, and see what errors are displayed. If there is no error or obvious cause, continue on.
If you see the above problems and think it's related to Select2 v3 usage, you can find which plugin/theme is loading the old library by:
- Right clicking the page
- View page source
- Search the source for
select2.min.js
orselect.js
- Look at the path/directory the script comes from. This will be the plugin loading it.
Unfortunately there is no way to 'fix' this directory due to the incompatibles between the 2 versions. The only ways this can be resolved are:
- Removing the conflicting plugin
- For extensions, following these instructions to be compatible with WC 3.0.x.
- Extensions modifying code to only load Select2 on their own admin pages.
- Extensions updating to Select2 v4.
WooCommerce is an open source commerce platform built for WordPress and lovingly crafted by Automattic and the WooCommerce community 💜. Come and work with us!
Contribution
- Set up development environment
- Our Git Flow
- SCSS and JS minification
- Naming conventions
- CSS SASS coding guidelines and naming conventions
- Critical Flows
- API Critical Flows
- String localisation guidelines
- Translating WooCommerce
- Deprecation in core
- Adding Actions and Filters
- Common Issues
- Writing high-quality testing instructions
Release Notes
- Release Testing Instructions
- 3.6.x notes/FAQ
- 2.6.x to 3.0.0 Developer Migration Notes
- Select2 fields not working in 3.0.x
- Thumbnail Image Regeneration in 3.3+
- Customizing image sizes in 3.3+
REST API and CLI
CRUD & Data Descriptions
- Database Description
- CRUD Objects in 3.0
- Order and Order Line Item Data
- Coupon Data
- Customer Data
- Product Data
- Data Stores
Internal APIs
Theming
- Enabling product gallery features (zoom, swipe, lightbox)
- Template File Guidelines for Devs and Theme Authors
Examples / Guides