Shopify themes, liquid, logos, and UX
Hello,
I want to build a theme using liquid templating but I'm having a problem with metaobjects :
I created a metaobject which have a "products" field of type "Reference : Collection".
So I tried to create a template page for this metaobject which will display the product list (just like the default Collection page template) but I cant access to the collection filters using metaobject.products.value.filters as I would use collection.filters in the default main-collection-product-grid.liquid template. I just get an empty array instead, and so I can't render the facets.liquid template to setup filters on this page.
Any idea on how I could get the filters ? I managed to access to every other data from the collection through this metaobject (products, title, image) but I just cannot acces to theses filters.
Daouda
Hi @Daouda_of_Mist ,
You try to check list below:
1. Filter in product index option has been turned on for that metafield yet.
2. Install https://apps.shopify.com/search-and-discovery app
3. Go to Apps -> Search and discovery -> Add filter
4. Check data whether has any products that has been added data for this field? It will don't show if that field don't exist on any products of that collection.
Hi,
Thanks for your answer but I think it does not respond to my demand :
- I created a "test_collection" collection
- I created a "Band" metaobject which contains a metafield named "products" of the type Collection
- I cretaed an entry for the "Band" metaobject named "test_metaobject", with the "test_collection" inside the produdct metafield for this entry
All the product metafields and indexes are corectly setup, and the filters works on the basic templates ( "/collections/test_collection").
The problem is : when I try to create a Liquid template for the "Band" metaobject ("/pages/band/test_metaobject") , I can get the collection of the "products" field through metaobject.products.value, but I cannot get the filters using metaobject.products.value.filters. So when I try to render the facets.liquid template inside the metaobject page template, it renders nothing.
Hi,
Hi @Daouda_of_Mist ,
It's impossible. Because Applied filters are reflected through URL parameters. When you can't use anywhere outside collection template/search template.
You can refer document here https://shopify.dev/docs/storefronts/themes/navigation-search/filtering/storefront-filtering/support...
Thanks for your anwser
So you are telling that we cannot manage theses URL parameters on metaobjects template, but only on search or collection page templates.
It's a real shame because it represents a huge limit when it comes to personalizing a Shopify based website site using complex data structures.
It also means that this kind of product listing template is available only for "/collections/xxx" pages which limits also the URL patterns, and this is really bad to maintain the SEO like our old website.
Do you know if there is a proper way to redirect the metaobject template to "upgraded" collection templates which could contain all the infos from my "Band" metaobject ? (I also will be necessary to "invert the references" -> putting the Band metaobject inside a metafield of the collection)
Hi @Daouda_of_Mist ,
You try to use Ajax to do it.
By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024