Shopify themes, liquid, logos, and UX
I'm trying to display the products I saved in a meta field on my product detail page, but all I get it is:
["GID://SHOPIFY/PRODUCT/7978216456473","GID://SHOPIFY/PRODUCT/7978217177369","GID://SHOPIFY/PRODUCT/7978217537817","GID://SHOPIFY/PRODUCT/7978217570585"] How can I render these products? I'm using the Dawn Theme.
Solved! Go to the solution
This is an accepted solution.
I got it working
I solved this by adding .value
{% for recommended_product in product.metafields.custom.styled_with.value %} {{ recommended_product.title }} {% endfor %}
Hi @phillip12,
you can extract each and every data of the product from the metafield using the product object of shopify.
You can take help of the product object doc of shopify to get a better idea on how you can extract the information: https://shopify.dev/api/storefront/2022-10/objects/product
NOTE: for this you need to have good coding knowledge of shopify liquid, else you can hire a developer for this work.
Thanks & Regards
Thanks. Do I have to use a query or something to get the product information based on the GID's?
No on liquid everything is based on handles.
You just need to add liquid expressions to extract the values.
for ex: {{ product.title }} would return product title
{{ product.description }} would return the description
I want to display the product information of the products I saved as a metafield, but all I get are GID's... How can I get the product information based on the GID's?
This is an accepted solution.
I got it working
I solved this by adding .value
{% for recommended_product in product.metafields.custom.styled_with.value %} {{ recommended_product.title }} {% endfor %}
what if i have a ''product-card'' snippet , with all product name , image styled already, is their any way i could use that snippet to display the product instead like printing one by one by using " {{ recommended_product.title }} "
2m ago Learn the essential skills to navigate the Shopify admin with confidence. T...
By Shopify Feb 12, 2025Learn how to expand your operations internationally with Shopify Academy’s learning path...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025