Name des Metafields in Shopify 2.0 anzeigen

Ich habe eine elegantere Lösung gefunden. Und zwar mit Lokalisation. In de.json einfach mehrere Felder hinzufügen und dann wie folgt verwenden:


  {% for field in product.metafields.custom %}
    {% assign attribute_code = field | first %}
    {% assign attribute_value = field | last %}
    {% assign attribute_localization_path = "products.product.metafields." | append: attribute_code %}

    
      
        {{ attribute_localization_path | t }}
      
      
        {{ attribute_value }}
      
    
  {% endfor %}