Home Forums WoodMart support forum Product Filters stop working after you remove

Product Filters stop working after you remove

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #44325

    jinsley8
    Participant

    Hi,

    I’ve been seeing issues with product filters when you add 1 or 2 then remove and try to select a new one, it doesn’t load anymore.

    On my link select the following steps:
    1. Select Flags & Banners under Product Type dropdown
    2. Select Large Banners under Product Type dropdown again
    3. now x out of both – remove/close
    4. Now try using the Product Type filter menu dropdown again, it doesn’t load the new selection

    #44388

    Artem Temos
    Keymaster

    Hi,

    As we can see, you are using some JS scripts to stylize default WooCoommerce select dropdown https://gyazo.com/bbc90b8e2ed7eed1ea2959d3e5b52bb8
    And this script is not initialized again after the AJAX request. For example when you clear your filters. That is why it doesn’t work while you do not reload the page. You need to disable this script or turn off our AJAX shop function in Theme Settings.

    Kind Regards

    #44397

    jinsley8
    Participant

    Does the regular dropdown not look like that in the theme?

    I didn’t notice this styling change or add anything that I know of.

    #44404

    Artem Temos
    Keymaster

    Here is a screenshot how it looks by default https://gyazo.com/5c66b9b38b85dc10792c049ed986ad2e

    #46919

    jinsley8
    Participant

    I disabled all plugins except the woodmart required plugins and Woocommerce but the dropdowns still look and act the same.

    The search input on the dropdowns shows its being styled by woocommerce.
    /wp-content/plugins/woocommerce/assets/css/select2.css

    I found this script that may have something to do with it?
    /wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.min.js

    I also found this script in the page source:

    <!-- WooCommerce JavaScript -->
    <script type="text/javascript">
    jQuery(function($) { 
    
    				// Update value on change.
    				jQuery( '.dropdown_layered_nav_product-type' ).change( function() {
    					var slug = jQuery( this ).val();
    					jQuery( ':input[name="filter_product-type"]' ).val( slug );
    
    					// Submit form on change if standard dropdown.
    					if ( ! jQuery( this ).attr( 'multiple' ) ) {
    						jQuery( this ).closest( 'form' ).submit();
    					}
    				});
    
    				// Use Select2 enhancement if possible
    				if ( jQuery().selectWoo ) {
    					var wc_layered_nav_select = function() {
    						jQuery( '.dropdown_layered_nav_product-type' ).selectWoo( {
    							placeholder: 'Any Product Type',
    							minimumResultsForSearch: 5,
    							width: '100%',
    							allowClear: true,
    							language: {
    								noResults: function() {
    									return 'No matches found';
    								}
    							}
    						} );
    					};
    					wc_layered_nav_select();
    				}
    			
    
    				// Update value on change.
    				jQuery( '.dropdown_layered_nav_product-subtype' ).change( function() {
    					var slug = jQuery( this ).val();
    					jQuery( ':input[name="filter_product-subtype"]' ).val( slug );
    
    					// Submit form on change if standard dropdown.
    					if ( ! jQuery( this ).attr( 'multiple' ) ) {
    						jQuery( this ).closest( 'form' ).submit();
    					}
    				});
    
    				// Use Select2 enhancement if possible
    				if ( jQuery().selectWoo ) {
    					var wc_layered_nav_select = function() {
    						jQuery( '.dropdown_layered_nav_product-subtype' ).selectWoo( {
    							placeholder: 'Any Product Subtype',
    							minimumResultsForSearch: 5,
    							width: '100%',
    							allowClear: true,
    							language: {
    								noResults: function() {
    									return 'No matches found';
    								}
    							}
    						} );
    					};
    					wc_layered_nav_select();
    				}
    			
    
    				// Update value on change.
    				jQuery( '.dropdown_layered_nav_product-subtype2' ).change( function() {
    					var slug = jQuery( this ).val();
    					jQuery( ':input[name="filter_product-subtype2"]' ).val( slug );
    
    					// Submit form on change if standard dropdown.
    					if ( ! jQuery( this ).attr( 'multiple' ) ) {
    						jQuery( this ).closest( 'form' ).submit();
    					}
    				});
    
    				// Use Select2 enhancement if possible
    				if ( jQuery().selectWoo ) {
    					var wc_layered_nav_select = function() {
    						jQuery( '.dropdown_layered_nav_product-subtype2' ).selectWoo( {
    							placeholder: 'Any Product Subtype2',
    							minimumResultsForSearch: 5,
    							width: '100%',
    							allowClear: true,
    							language: {
    								noResults: function() {
    									return 'No matches found';
    								}
    							}
    						} );
    					};
    					wc_layered_nav_select();
    				}
    			
    
    				// Update value on change.
    				jQuery( '.dropdown_layered_nav_country' ).change( function() {
    					var slug = jQuery( this ).val();
    					jQuery( ':input[name="filter_country"]' ).val( slug );
    
    					// Submit form on change if standard dropdown.
    					if ( ! jQuery( this ).attr( 'multiple' ) ) {
    						jQuery( this ).closest( 'form' ).submit();
    					}
    				});
    
    				// Use Select2 enhancement if possible
    				if ( jQuery().selectWoo ) {
    					var wc_layered_nav_select = function() {
    						jQuery( '.dropdown_layered_nav_country' ).selectWoo( {
    							placeholder: 'Any Country',
    							minimumResultsForSearch: 5,
    							width: '100%',
    							allowClear: true,
    							language: {
    								noResults: function() {
    									return 'No matches found';
    								}
    							}
    						} );
    					};
    					wc_layered_nav_select();
    				}
    			
    
    				// Update value on change.
    				jQuery( '.dropdown_layered_nav_club' ).change( function() {
    					var slug = jQuery( this ).val();
    					jQuery( ':input[name="filter_club"]' ).val( slug );
    
    					// Submit form on change if standard dropdown.
    					if ( ! jQuery( this ).attr( 'multiple' ) ) {
    						jQuery( this ).closest( 'form' ).submit();
    					}
    				});
    
    				// Use Select2 enhancement if possible
    				if ( jQuery().selectWoo ) {
    					var wc_layered_nav_select = function() {
    						jQuery( '.dropdown_layered_nav_club' ).selectWoo( {
    							placeholder: 'Any Club',
    							minimumResultsForSearch: 5,
    							width: '100%',
    							allowClear: true,
    							language: {
    								noResults: function() {
    									return 'No matches found';
    								}
    							}
    						} );
    					};
    					wc_layered_nav_select();
    				}
    			
    
    				// Update value on change.
    				jQuery( '.dropdown_layered_nav_hot-brand' ).change( function() {
    					var slug = jQuery( this ).val();
    					jQuery( ':input[name="filter_hot-brand"]' ).val( slug );
    
    					// Submit form on change if standard dropdown.
    					if ( ! jQuery( this ).attr( 'multiple' ) ) {
    						jQuery( this ).closest( 'form' ).submit();
    					}
    				});
    
    				// Use Select2 enhancement if possible
    				if ( jQuery().selectWoo ) {
    					var wc_layered_nav_select = function() {
    						jQuery( '.dropdown_layered_nav_hot-brand' ).selectWoo( {
    							placeholder: 'Any Hot Brand',
    							minimumResultsForSearch: 5,
    							width: '100%',
    							allowClear: true,
    							language: {
    								noResults: function() {
    									return 'No matches found';
    								}
    							}
    						} );
    					};
    					wc_layered_nav_select();
    				}
    			
    
    				// Update value on change.
    				jQuery( '.dropdown_layered_nav_sub-brand' ).change( function() {
    					var slug = jQuery( this ).val();
    					jQuery( ':input[name="filter_sub-brand"]' ).val( slug );
    
    					// Submit form on change if standard dropdown.
    					if ( ! jQuery( this ).attr( 'multiple' ) ) {
    						jQuery( this ).closest( 'form' ).submit();
    					}
    				});
    
    				// Use Select2 enhancement if possible
    				if ( jQuery().selectWoo ) {
    					var wc_layered_nav_select = function() {
    						jQuery( '.dropdown_layered_nav_sub-brand' ).selectWoo( {
    							placeholder: 'Any Sub Brand',
    							minimumResultsForSearch: 5,
    							width: '100%',
    							allowClear: true,
    							language: {
    								noResults: function() {
    									return 'No matches found';
    								}
    							}
    						} );
    					};
    					wc_layered_nav_select();
    				}
    			
     });
    </script>
    #46922

    jinsley8
    Participant

    Also – the widget being used is the Filter Product by Attribute.

    #46951

    Artem Temos
    Keymaster

    Please, provide us your admin and FTP access so we can check what to do there.

Viewing 7 posts - 1 through 7 (of 7 total)