Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Hide elements in filters only if unchecked

Krzysztof Białogłowicz5ba0478c49e3
diff --git a/saleor/static/js/components/categoryPage/ProductFilters.js b/saleor/static/js/components/categoryPage/ProductFilters.js
index 6d3b28e7a0..1df858b45e 100644
--- a/saleor/static/js/components/categoryPage/ProductFilters.js
+++ b/saleor/static/js/components/categoryPage/ProductFilters.js
@@ -54,23 +54,23 @@ class ProductFilters extends Component {
{attribute.display}
<i className={visibility[attribute.name] ? ('fa fa-chevron-up pull-right') : ('fa fa-chevron-down pull-right')} aria-hidden="true" onClick={() => this.changeVisibility(attribute.name)}></i>
</h3>
- {visibility[attribute.name] ? (
<ul id={attribute.name}>
{attribute.values.map((value) => {
const key = this.getFilterKey(attribute.name, value.slug);
- return (
- <li key={value.id} className="item">
- <AttributeInput
- attribute={attribute}
- checked={checkedAttributes.includes(key)}
- onClick={this.onClick}
- value={value}
- />
- </li>
- );
+ if(visibility[attribute.name] || checkedAttributes.includes(key)) {
+ return (
+ <li key={value.id} className="item">
+ <AttributeInput
+ attribute={attribute}
+ checked={checkedAttributes.includes(key)}
+ onClick={this.onClick}
+ value={value}
+ />
+ </li>
+ );
+ }
})}
</ul>
- ) : (null)}
</div>
);
}))}