Request for improvements: 'where' filter on prices/rrp #1861
Open
Description
There is an issue on using the 'where' filter on product.variants with prices that doesn't work to correctly pull out valid prices from the variant array.
This occurs when using price with a number or string.
Liquid to verify:
assign test_all_variant_prices = product.variants | map: 'price'
echo test_all_variant_prices | json | prepend: '<p>Variant prices: ' | append: '</p>'
assign test1_product_price = product.variants | where: 'price', 12502
echo test1_product_price | json | prepend: '<p>Price tested with number: ' | append: '</p>'
assign test2_product_price = product.variants | where: 'price', '12502'
echo test2_product_price | json | prepend: '<p>Price tested with string: ' | append: '</p>'
Output from the liquid above:
Variant prices: [12502]
Price tested with number: []
Price tested with string: []
Interesting though is that if you do the following with a map you can prove that the where does work, but it doesn't seem to work on returning the variant objects.
assign test1 = product.variants | map: 'price'
echo test1 | json | prepend: '<p>output 1: ' | append: '</p>'
assign test2 = product.variants | map: 'price' | where: 12502
echo test2 | json | prepend: '<p>output 2: ' | append: '</p>'
Output from the liquid:
output 1: [12502]
output 2: [12502]
Metadata
Assignees
Labels
No labels