Hide out of stock products from any filter - #984
Conversation
msaustral
commented
Feb 13, 2024
| Questions | Answers |
|---|---|
| Description? | We have add an option on the settings to hide products without stock, this solve the issue PrestaShop/PrestaShop#10018. Also when this option is enable, it disable the Availability filter, if the filter was enabled before activating the option "Hide out of stock", it deletes from table layered_category any availability type register to disable it |
| Type? | improvement |
| BC breaks? | no |
| Deprecations? | no |
| Fixed ticket? | PrestaShop/PrestaShop#10018 |
| How to test? | On the setting enable the option: "Hide out of stock" |

|
also solve issue: PrestaShop/PrestaShop#16952 |
|
What's the purpose of this filter? You can just click "Available" in Availability filter and it will show you the exact same thing. |
|
Hi, for example, on fashion industry, if a client filter T-shirt size M, you do not want products without stock on M to appear on the list. Some industry do not want to show products without stock on the product list other do, that is why the function is optional. If someone want to show products without stocks, it works as normal. |
|
Hi, what is the progress on this review. |
|
The stock filter is dropped from if (Configuration::get('PS_LAYERED_FILTER_HIDE_OUT_OF_STOCK') === '0'){
Two things would close it:
Worth noting for whoever reviews the behaviour rather than the code: the |
|
Hello @msaustral, you can now implement your behavior easily via public function hookActionFacetedSearchFilters($params) {
$params['search']->getSearchAdapter()->addOperationsFilter(
'with_stock_management',
[[['quantity', [0], '>']]]
);
} |
|
Hi @Hlavtox the idea of opening this in 2024 (WOW), was to converted in a function that comes already with in the native module without need of building another module on top. Just adding couple of lines you allow salers to have the control of showing or not productos or attributes out sock |