Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hey there, I have created a new custom page on shopify and the url of that page is https://domain.com/pages/salt/salt-x
Now I want to get data of salt dynamically on to the page through liquid code, but not able to display the data, Please help.
Once you've created a metaobject like in your screenshots.
You can view it in the CMS admin:
If there is no 'Theme template' assigned to the MetaObject item, there will a button to create one on that screenshot above. It will take you to the theme customizer and ask to create a template.
You can add sections, connect them to specific metafields, and save it to save the template file for all MetaObject template.
You can open that file in theme edit and access see how the section exists in the theme template:
If you want to edit Liquid/HTML/CSS more directly (I'm assuming you want some kind of custom layout on this page?) then one approach is to create yourself a custom section that can be inserted within the customizer and linked up to the metafields via customizer or through the template json.
Be good to know what kind of layout or use-case you are going for here and why that has lead you the need for a custom MetaObject.
Please tell me more specifically about how get that Object dynamically in liquid and show the products data after iterating it on the page.
Forexample I have been trying following solution:
{% assign salt_x_products = shop.metaobjects[request.path].fields['product_salt.products'] %}
{% for product in salt_x_products %}
<div class="product">
<h2>{{ product.title }}</h2>
<p>{{ product.description }}</p>
<img src="{{ product.featured_image | img_url: 'medium' }}" alt="{{ product.title }}">
<p>{{ product.price | money }}</p>
</div>
{% endfor %}
What is the relationship between the custom meta object "salt x" and products on your site?
What are you trying to loop through? Eg products or metaobjects?
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024