Hi guys, is there a way to use the reject filter to a metaobject list and remove from the entire array the entries with specific ID?
What i am trying to achieve is something like this:
{% assign final_list = null %}
{% for id in list_of_blocked_ids %}
{% assign final_list = all_entries| reject: 'system.id', id %}
{% endfor %}
But so far, it is still returning the full list…
1 Like
Hey @Pedro_Carrera
Have not actually tried using reject
yet, but my guess would be your snippet doesnt work due to deep linking (system.id
). Like other filters, I think you can only map at one level.
Hi @curzey - yes, sadly but I think so…
@Pedro_Carrera ,
I think there is issue in your code. You are reassigning the final_list. Try with this code:
{% assign final_list = all_entries %}
{% for id in list_of_blocked_ids %}
{% assign final_list = final_list | reject: ‘system.id’, id %}
{% endfor %}