Shopify themes, liquid, logos, and UX
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
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