woocommerce / selectWoo

selectWoo is a fork of select2 with improved accessibility.
MIT License
124 stars 27 forks source link

Cannot read property 'trim' of undefined #46

Open NenadObradovic opened 3 years ago

NenadObradovic commented 3 years ago

Hello guys,

After updating the WooCommerce plugin to the latest version 5.4.0 - the select2 script stop working.

Main shop page - on dropdown click, I got - Cannot read property 'trim' of undefined

https://imgur.com/DlFV0A8 https://imgur.com/dfbDqrL

JS code which we use

this.holder = [];
this.holder.push(
    {
        holder: $( '.woocommerce-ordering select' ),
        options: {
            minimumResultsForSearch: Infinity
        }
    }
);

if ( typeof this.holder === 'object' ) {
    $.each(
        this.holder,
        function ( key, value ) {

            if ( typeof value.holder.select2 === 'function' ) {
                value.holder.select2( value.options );
            }
        }
    );
}

Best regards, Nenad