djrmom
10/17/2017 - 3:35 PM

facetwp reset another facet on dropdown change

facetwp reset another facet on dropdown change

(function($) {
    $(document).on('change', '.facetwp-facet-product_categories', function() { // change product_categories to name of dropdown facet
        FWP.is_reset = true;
        FWP.facets['product_tags'] = []; // set other facet to no selections
        delete FWP.facets['paged']; // remove "paged" from URL
        FWP.refresh();
    });
    $(document).on('change', '.facetwp-facet-product_tags', function() { // change product_tags to name of dropdown facet
        FWP.is_reset = true;
        FWP.facets['product_categories'] = []; // set other facet to no selections
        delete FWP.facets['paged']; // remove "paged" from URL
        FWP.refresh();
    });
})(jQuery);