SelectWoo issue with attributes
-
Hi!
Recently we updated WooCommerce from 2.5.2 to 5.2.0. We fixed most of the errors related to the update, but there is one issue with the selectWoo library and product attributes on the edit page.
Basically, we’ve noticed that there are no attribute values on the product edit page in the admin panel both for new products and for products that exist before the update. When I looked in the developer’s tools in Chrome, I’ve noticed that there are no “<option>” tags in “<select>” tags of the attributes. If I disable JS and reload the page, then all values are there, so there is no problem with DB or PHP side I believe.
Also, when I replaced all “selectWoo” functions in the wp-content/plugins/woocommerce/assets/js/admin/wc-enhanced-select.js file with “select2” functions, for example
$( this ).selectWoo( select2_args ).addClass( 'enhanced' );
to
$( this ).select2( select2_args ).addClass( 'enhanced' );
and reloaded the page with JS enabled, all worked well, all “<option>” tags with values were inside all “<select>” tags, and everything worked fine.Also, if I use the original wc-enhanced-select.js with selectWoo functions and on the edit page click on the “Add” button to add an attribute, then that attribute adds as expected and it works. Of course, if I then save the attribute value by clicking the “Save attributes” button, then old attributes with “empty” values will be erased because in the save request there will be no values for them.
Any idea why the attributes that already on the page aren’t working and attributes that were added after the page loaded are working? And why if I change selectWoo function calls to select2 all works fine?
Please update me if you need more information.
Thank you!
- The topic ‘SelectWoo issue with attributes’ is closed to new replies.