[solved] Display Product metafield definition

Hi all, I apologize for asking a dumb question, but I can’t find a simple solution to show a list of related products.
I have created a “Product metafield definition” where I enter the products I would like to show, but from there I cannot display them in the product page through a Custom Liquid.
If I print out the array, it contains [“gid://shopify/Product/xxxx”, “gid://shopify/Product/yyyy”, “gid://shopify/Product/zzz”], but from there I can’t generate the loop to show the photo and link.

{% assign related_products = product.metafields.custom.related_product_dynamic %}

{% if related_products.size > 0 %}
  
    ### Prodotti correlati
    
      {% for product_gid in related_products %}
        {% assign product_id = product_gid | split: '/' | last %}
        {% assign related_product = all_products[product_id] %}
        {% if related_product %}
          - {{ related_product.title }}
                {{ related_product.price | money }}
            
          
        {% endif %}
      {% endfor %}
    

  

{% endif %}

I think that the problem shoud be focused here:

{% assign related_product = all_products[product_id] %}

I know that all_products only accepts handle, but how do I create the object if I only have the array?

I don’t want to install any app, but I need to resolve this issue.

Thank you in advance,
Luca

solved with this snippet:


	{% for recommended_product in product.metafields.custom.related_product_dynamic.value %}
		

			
	  	  		
	  			
{{ recommended_product.title }}
			
		

	{% endfor %}