Shopify themes, liquid, logos, and UX
Hi there,
I'm having some difficulties with receiving a product title when I use a variable as handle.
<ul>
{% assign colorProduct = product.metafields.custom.json.a %}
<li>{{colorProduct}}:{{ all_products[colorProduct].title }}</li>
</ul>
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?
Solved! Go to the solution
This is an accepted solution.
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 }}
This is an accepted solution.
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
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024