jenny-r
9/27/2017 - 1:07 PM

facetwp check a single facet

facetwp check a single facet

<script>
        (function($) {
            /**
             * check if a facet exists but is empty, change 'categories' to name of the facet being checked
             */
            $(document).on('facetwp-loaded', function() {
                if ('undefined' !== typeof FWP.facets['categories'] && FWP.facets['categories'].length < 1 ) {
                    // do something if facet is empty
	            }
            });
        })(jQuery);
</script>