How Do I Get MetaObject Values On Single MetaObject Page In Shopify

4.3k Views Asked by At

I am using metaObjects in shopify. I have created a metaObject name "Projects" . I created a page "Projects" to display those saved projects through liquid code. It is working as per the requirement on Projects page but now i want to display each project detail on single page. How do i approach this ? Like should i create a page and set a template on it and in that template , fetch the metaobject handle to display its details . I am facing issue like how do i call the same single page for all projects details and display its details. Can someone please guide what is the possible way to get each metaObject values on single project page .

Thanks

1

There are 1 best solutions below

0
On

After you have created your meta object definition in the Shopify admin you need to then create another definition on your project page with the field type of metaobject I did the following for products to accomplish this :

  1. Created meta-object of benefit and added a single text field.

  2. Created a metafield for product which was called a mixed reference list and referenced the benefits meta object i created.

  3. Added a couple of benefits with the new meta field in the product admin.

  4. Added liquid to display the list of benefits attached to the page :

      {% for item in product.metafields.custom.benefits.value -%}
    • {{ item.benefits }}
    • {%- endfor %}

I hope this helps!