• Resolved koichirose

    (@koichirose)


    Hello,

    I need to style the variations <select> differently, so I’m using this plugin: https://select2.github.io/

    I need to instantiate select2 after Woocommerce is done updating the <select> with the available <option>s, otherwise the styled <select> will have all options.

    Which event should I listen on? I pretty much tried everything that gets fired in ‘add-to-cart-variation.js’, like this:

    
    jQuery('.bundle_form').on('woocommerce_variation_select_change', function() {
     //code to instantiate select2
    });
    

    The above code only works when I first change a select, whereas I need it to execute on page load (right after woocommerce is done).

    Thank you

Viewing 1 replies (of 1 total)
  • Thread Starter koichirose

    (@koichirose)

    Hi,

    I found out nothing is triggered on page load.
    So I’m triggering ‘focusin’ myself and then listening to the ‘woocommerce_update_variation_values’ event.

    Marking this as solved.

Viewing 1 replies (of 1 total)
  • The topic ‘How to listen to variations events’ is closed to new replies.