Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude facet options if there they are unavailable #2760

Closed
Zyles opened this issue May 12, 2022 · 1 comment · Fixed by #2989
Closed

Exclude facet options if there they are unavailable #2760

Zyles opened this issue May 12, 2022 · 1 comment · Fixed by #2989
Assignees
Labels
enhancement module:facets Issues related to the Facets functionality
Milestone

Comments

@Zyles
Copy link

Zyles commented May 12, 2022

Is your enhancement related to a problem? Please describe.

When you enter a Woocommerce category or use the search and the taxonomy is not available to facet on all the options are greyed out.

I would like the option to hide them completely.

This becomes a problem when you have a "brand" attribute with 100+ brands. I rather only show the relevant brands instead of all brands in the store.

Same goes for product categories. The list can become really big with greyed out categories instead of just showing the relevant ones.

Describe the solution you'd like

Hide all greyed out facets completely from the facet.

@felipeelia
Copy link
Member

This would be an interesting option @Zyles, thanks. In the meantime, the ep_facet_widget_term_html filter can be used to achieve a similar result:

add_filter(
	'ep_facet_widget_term_html',
	function( $html, $term ) {
		return ( ! empty( $term->count ) ) ? $html : '';
	},
	10,
	2
);

Note: worth pointing out the "similar" there, as the search field displayed above the list will not use the correct number of terms being displayed.

@felipeelia felipeelia added the module:facets Issues related to the Facets functionality label Jun 2, 2022
@felipeelia felipeelia added this to the 4.4.0 milestone Aug 29, 2022
@burhandodhy burhandodhy assigned felipeelia and unassigned burhandodhy Sep 6, 2022
@felipeelia felipeelia modified the milestones: 4.4.0, 4.3.1 Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement module:facets Issues related to the Facets functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants