All_products with varible json handle not working

Hi there,

I’m having some difficulties with receiving a product title when I use a variable as handle.


  {% assign colorProduct = product.metafields.custom.json.a %}
- {{colorProduct}}:{{ all_products[colorProduct].title }}

Output:

skinny-enkel-jeans-roxanne-|-lichtblauw:


I am able to output the handle as HTML but not as a variable. Could anybody tell me what I’m doing wrong?

Is that actually the product’s handle? As far as I know, there should be no special characters in a handle, I see you have a pipe character “|” – that may be incorrect. Because it looks like you’re approaching the output correctly for using {{ all_products[product-handle].title }}

Thank you ninthony! That was it