Forum
Exclude two stock levels
Due to some programming mistakes we have products with stock level 0 and 3. 3 as you know is out of stock and 0 is unlimited.
Can we filter out both 0 and 3?
Like
'filter'=> [
['filter'=> 'stock_level', 'match'=> 'neq', 'value'=> 3 ],
[ 'filter'=> 'stock_level', 'match'=> 'neq', 'value'=> 0 ],
'match'=>'or'
]
Edit. Maybe a regex?
Answering myself
['filter' => 'stock_level', 'match'=> 'regex', 'value'=> "^[^0|^3]+$"]
Edit. That didn't do the trick. The regex seems to be matching 10 and 30 for example.
Anyone know the right regex to exclude 0 and 3 from a filter match?
^(?!3$|0$).*$
doesn't work^[^0|^3]+$
matches 10 30 35
Hello Lexi,
It sounds like you are looking for
stock_status
notstock_level
.Something like this should work: