All things Shopify and commerce
Hi,
How can I retrieve the product details (name, image, url etc) for an object handle?
Thanks
Hi
You can do it via liquid objects like below are some examples
<h1 class="title">{{ product.title }}</h1>
<a href="{{ product.url }}">URL of Product</a>
<img src="{{ product.featured_image }}" alt="Product Image" />
You can read about this more at here - https://shopify.dev/docs/themes/liquid/reference/objects/product
There is one Shopify Cheat sheet where you can find all the object at one place - https://www.shopify.in/partners/shopify-cheat-sheet
Thank you 🙏
Hi @miniscript,
I have coded a section with this schema:
{% schema %}
{
"name": {
"en": "Featured reviews"
},
"class": "featured-reviews",
"max_blocks": 12,
"blocks": [
{
"type": "custom",
"name": {
"en": "Product review"
},
"settings": [
{
"type": "product",
"id": "feature_product",
"label": {
"en": "Product"
}
}
]
}
]
}
{% endschema %}
But when I try {{ block.settings.feature_product.title }}, I don't get anything.
Any idea guys?
You’re doing it wrong in Schema - Here is the correct code for that
{% for block in section.blocks %}
{{ block.feature_product.title }}
{% endfor %}
If you're using section block for that you need to loop through this first.
{% assign pdt = all_products[handle] %}
<a href="youwebsite.com/product/{{ handle }}">
<img src="{{ pdt.featured_image | img_url: 'medium' }}" alt="{{ pdt.title }}">
<p>{{ pdt.title }}</p>
</a>
Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025