Answer the question
In order to leave comments, you need to log in
How to implement a multi-select filter for WooCommerce?
I am writing a widget with filters for products and there was a gag when implementing multiple selection.
For example, there is this form:
<form id="woo-filter__form" class="woo-filter__form" method="GET" action="">
<input id="pa_color_white" class="form-check-input woo-filter__checkbox" type="checkbox" name="filter_color" value="white">
<label class="form-check-label woo-filter__label" for="pa_color_white">Белый</label>
<input id="pa_color_black" class="form-check-input woo-filter__checkbox" type="checkbox" name="filter_color" value="black">
<label class="form-check-label woo-filter__label" for="pa_color_black">Чёрный</label>
<input id="pa_color_red" class="form-check-input woo-filter__checkbox" type="checkbox" name="filter_color" value="red">
<label class="form-check-label woo-filter__label" for="pa_color_red">Красный</label>
<input id="pa_color_blue" class="form-check-input woo-filter__checkbox" type="checkbox" name="filter_color" value="blue">
<label class="form-check-label woo-filter__label" for="pa_color_blue">Голубой</label>
<button id="woo-filter__submit" class="btn btn-primary woo-filter__submit" type="submit">Accept filters</button>
</form>
?color=red&color=white
?color=red,white
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question