When I log in and view the home page, the Testimonial carousel works fine. However, when I view it without logging in, it doesn’t function properly. I’ve observed that an error appears in the console when I access the page without logging in. I’m not sure why carousel not working, Could you please helps us to solve this issue. Here is my URL https://www.absolute-aromas.com/
<code>https://c0.wp.com/c/6.5.5/wp-includes/js/jquery/jquery.min.js
Uncaught TypeError: $j(...).select2 is not a function
at initSelect2 (woocommerce.min.js:1:108)
at HTMLDocument.<anonymous> (woocommerce.min.js:1:7710)
at e (jquery.min.js:2:27028)
at t (jquery.min.js:2:27330)
</code>
<code>https://c0.wp.com/c/6.5.5/wp-includes/js/jquery/jquery.min.js
Uncaught TypeError: $j(...).select2 is not a function
at initSelect2 (woocommerce.min.js:1:108)
at HTMLDocument.<anonymous> (woocommerce.min.js:1:7710)
at e (jquery.min.js:2:27028)
at t (jquery.min.js:2:27330)
</code>
https://c0.wp.com/c/6.5.5/wp-includes/js/jquery/jquery.min.js
Uncaught TypeError: $j(...).select2 is not a function
at initSelect2 (woocommerce.min.js:1:108)
at HTMLDocument.<anonymous> (woocommerce.min.js:1:7710)
at e (jquery.min.js:2:27028)
at t (jquery.min.js:2:27330)
<code>jQuery.Deferred exception: $j(...).select2 is not a function TypeError: $j(...).select2 is not a function
at initSelect2 (https://www.absolute-aromas.com/wp-content/cache/w3-cache/js/13/wp-content/themes/bridge/js/woocommerce.min.js:1:108)
at HTMLDocument.<anonymous> (https://www.absolute-aromas.com/wp-content/cache/w3-cache/js/13/wp-content/themes/bridge/js/woocommerce.min.js:1:7710)
at e (https://c0.wp.com/c/6.5.5/wp-includes/js/jquery/jquery.min.js:2:27028)
at t (https://c0.wp.com/c/6.5.5/wp-includes/js/jquery/jquery.min.js:2:27330) undefined
</code>
<code>jQuery.Deferred exception: $j(...).select2 is not a function TypeError: $j(...).select2 is not a function
at initSelect2 (https://www.absolute-aromas.com/wp-content/cache/w3-cache/js/13/wp-content/themes/bridge/js/woocommerce.min.js:1:108)
at HTMLDocument.<anonymous> (https://www.absolute-aromas.com/wp-content/cache/w3-cache/js/13/wp-content/themes/bridge/js/woocommerce.min.js:1:7710)
at e (https://c0.wp.com/c/6.5.5/wp-includes/js/jquery/jquery.min.js:2:27028)
at t (https://c0.wp.com/c/6.5.5/wp-includes/js/jquery/jquery.min.js:2:27330) undefined
</code>
jQuery.Deferred exception: $j(...).select2 is not a function TypeError: $j(...).select2 is not a function
at initSelect2 (https://www.absolute-aromas.com/wp-content/cache/w3-cache/js/13/wp-content/themes/bridge/js/woocommerce.min.js:1:108)
at HTMLDocument.<anonymous> (https://www.absolute-aromas.com/wp-content/cache/w3-cache/js/13/wp-content/themes/bridge/js/woocommerce.min.js:1:7710)
at e (https://c0.wp.com/c/6.5.5/wp-includes/js/jquery/jquery.min.js:2:27028)
at t (https://c0.wp.com/c/6.5.5/wp-includes/js/jquery/jquery.min.js:2:27330) undefined
I tried to disable cache but it’s not working, few days ago it’s working properly.
2
A per what I have checked, you need to convert below:
<code>function initSelect2() {
$j(".woocommerce-ordering .orderby, #calc_shipping_country, #dropdown_product_cat").select2({
minimumResultsForSearch: -1
}),
$j(".woocommerce-account .country_select").select2()
}
</code>
<code>function initSelect2() {
$j(".woocommerce-ordering .orderby, #calc_shipping_country, #dropdown_product_cat").select2({
minimumResultsForSearch: -1
}),
$j(".woocommerce-account .country_select").select2()
}
</code>
function initSelect2() {
$j(".woocommerce-ordering .orderby, #calc_shipping_country, #dropdown_product_cat").select2({
minimumResultsForSearch: -1
}),
$j(".woocommerce-account .country_select").select2()
}
To:
<code>function initSelect2() {
if($j(".woocommerce-ordering .orderby").length > 0){
$j(".woocommerce-ordering .orderby").select2({
minimumResultsForSearch: -1
});
}
if($j("#calc_shipping_country").length > 0){
$j("#calc_shipping_country").select2({
minimumResultsForSearch: -1
});
}
if($j("#dropdown_product_cat").length > 0){
$j("#dropdown_product_cat").select2({
minimumResultsForSearch: -1
});
}
if($j(".woocommerce-account .country_select").length > 0 ){
$j(".woocommerce-account .country_select").select2()
}
}
</code>
<code>function initSelect2() {
if($j(".woocommerce-ordering .orderby").length > 0){
$j(".woocommerce-ordering .orderby").select2({
minimumResultsForSearch: -1
});
}
if($j("#calc_shipping_country").length > 0){
$j("#calc_shipping_country").select2({
minimumResultsForSearch: -1
});
}
if($j("#dropdown_product_cat").length > 0){
$j("#dropdown_product_cat").select2({
minimumResultsForSearch: -1
});
}
if($j(".woocommerce-account .country_select").length > 0 ){
$j(".woocommerce-account .country_select").select2()
}
}
</code>
function initSelect2() {
if($j(".woocommerce-ordering .orderby").length > 0){
$j(".woocommerce-ordering .orderby").select2({
minimumResultsForSearch: -1
});
}
if($j("#calc_shipping_country").length > 0){
$j("#calc_shipping_country").select2({
minimumResultsForSearch: -1
});
}
if($j("#dropdown_product_cat").length > 0){
$j("#dropdown_product_cat").select2({
minimumResultsForSearch: -1
});
}
if($j(".woocommerce-account .country_select").length > 0 ){
$j(".woocommerce-account .country_select").select2()
}
}
What is updated here: First check whether the element is available or not, if yes then only apply select2
5