The error we are getting is: Liquid error: undefined method `split’ for nil:NilClass
If I change the second without using .key I’m getting as error:
Liquid error: Custom values can only go two levels deep
The custom[firstfori.key] cannot really exists, as the firstfori is what? It isn’t made, as you are outside the code from the very first forloop.
You are doing a nested forli-loops, right? May I suggest the following (and also, please check our coding guidelines, as the naming of certain code is a little bit misleading, if you don’t mind me saying ) :
{% comment %}original FORI{% endcomment %}
{% fori item in custom.beneficiary %}
{% input item.name_beneficiary placeholder:"beneficiary" %}
{% endfori %}
{% comment %}
next up, is to loop over each loop from the FIRST
now, what makes each loop from the FIRST unique, is indeed the key.
and we will use that value to create an extra custom collection, as collections can only go one level deep
{% endcomment %}
{% for item in custom.beneficiary %}
{{ item.name_beneficiary }}
{% comment %}create unique collection with key of loop{% endcomment %}
{% capture bene_key %}bene_{{ item.key }}{% endcapture %}
{% comment %}create extra fori-loop (aka nested fori loop){% endcomment %}
{% fori item in custom[bene_key] %}
{% input item.contract_date as:date %}
{% endfori %}
{% endfor %}
Is this something you can built upon further? Let me know what you exactly are trying to built (probably a collection to enter beneficiaries, and each one need to be able to enter multiple dates; something like that), and I might be able to explain it better though