You can achieve this sort by ```"sort_by": "$avail...
# community-help
h
You can achieve this sort by
Copy code
"sort_by": "$availability_warehouse_1(_eval(is_available:true):desc), $availability_warehouse_357(_eval(is_available:true):desc), is$availability_warehouse_1181(_eval(is_available:true):desc)"
But it's not possible to merge the fields such that if a product is available in any one of these warehouses the document would have
is_available:true
. Merge including will have the value of the last reference doc merged. So you'll have to add some front-end logic in this case to check for the availability.