• Resolved madaolex

    (@madaolex)


    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!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Gabriel – a11n

    (@gabrielfuentes)

    Hi there ??

    This is a fairly complex development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.

    You can also visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    Cheers.

    Plugin Support Gabriel – a11n

    (@gabrielfuentes)

    We’ve not seen any activity on this thread for a while, so I’m marking this thread as resolved.

    Hopefully, you were able to find a solution to your problem! If you have further questions, please feel free to open a new topic.

    Cheers!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘SelectWoo issue with attributes’ is closed to new replies.