liquid icon indicating copy to clipboard operation
liquid copied to clipboard

Handle boolean values in sort filter comparison

Open andershagbard opened this issue 2 months ago • 0 comments

  • Updated nil_safe_compare to treat booleans
  • Added tests to verify correct sorting of arrays containing boolean values and nils.

Solves weird hacks like this:

{% liquid
  assign available_variants = product.variants | where: 'available', true
  assign unavailable_variants = product.variants | where: 'available', false
  assign sorted_variants = available_variants | concat: unavailable_variants

Unsure why I didn't get a fresh master branch when creating this branch. Sorry...

andershagbard avatar Oct 10 '25 22:10 andershagbard