Company Users
2 TopicsLiquid arrays personalization
Hello everyone I'm trying to implement this liquid code in one of my templates: {% assign combinedResults = canvas_entry_properties.${data}.results | concat: canvas_entry_properties.${data}.featuredResults %} {% assign results = combinedResults | sort: 'totalEstimatedCost.amount' | reverse %} The arrays canvas_entry_properties.${data}.results and canvas_entry_properties.${data}.featuredResults are two arrays that contain a list of offers, with each offer having a name, an ID, and a totalEstimatedCost.amount Using this Liquid code, I want to first create a third array called combinedResults that merges the offers from both canvas_entry_properties.${data}.results and canvas_entry_properties.${data}.featuredResults. Then, I want to sort this combined array so that the offers are displayed in descending order based on totalEstimatedCost.amount, from the highest to the lowest price However, the issue is that the displayed list first shows the two offers from the featuredResults array sorted in ascending order (from the smallest to the largest price), followed by the five offers from the results array sorted in descending order (from the largest to the smallest price). Do any of you know why this could happen? the structure of the original arrays is the same. Thank you in advance!90Views1like2Comments