Shopify themes, liquid, logos, and UX
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
I am having difficulty connecting a metafield to a "related products" block in my Horizon (Atelier version) theme, on a page template for project blog posts.
The idea is to have select products that I assign, via the blog post metafield, show up on that specific blog post only (and for this to be able to be a function that I can use on all blog posts).
I have contacted Shopify support but they don't have a solution - which I find weird, becauase it's their theme -- I would think connecting dynamic content that you create using metafields would be something that should work (especially on a new Shopify theme).
Here are the steps I have taken:
I created the metafield "blog-post-product" as shown below:
I created a blog post, and in the metafield section at the bottom of that blog post, I selected a product "Sample Product 2":
I went to my page template for the project blog post and inserted a "related products" block:
Then I went to the product button at the top right of the screen and clicked on the "stacked discs" icon to add dynamic content --- but it could not find the metafield "blog-post-product" that I had previously created (which has API / STOREFRONT access enabled):
**** I do not have a live site at the moment -- does anyone have a clue as to why the theme is not finding my created blog post metafield in this list at all??
The only metafield that comes up is what the theme is pulling, called: closest - "Product" -- which is just the standard product metafield on every Shopify theme. None of the dropdown lists show my metafield listed, and it doesn't appear when I search in those menus either.
Hi there! I was wondering if I was really missing something or if it was just not there - clearly just not there so thank you for offering to help me!
I think this is what you need to help me out with the code: custom.blog_post_product
would you be able to help me out with a snippet for individual products as well as for displaying multiple related products, so I have it in case I need it as I continue working on my site?
Is this just an issue with blog related templates that you're aware of?
I am not totally confident on this but i believe recommended products is not the section you might be looking to add your metafield based product. Recommended section is a section by Shopify which automatically selects or showcases products based on the product page you are at based on their own backend logic and which does not allow to add your own product.
If you want to let yourself choose products and display them, you might want to create a new custom section entirely that lets you choose products from the customizer or add it via metafields.
It's totally possible by using the "related products" block from shopify - seems to be that the Horizon theme is the issue. I've seen Youtube videos of people adding in products on blog post pages by using the related products block and metafields - that's what sparked me to do it. But it turns out Shopify's latest theme is experiencing a shortfall.
I believe the person used the Dawn theme though in the Youtube video so, oh well - super crappy, and Shopify should make this possible in Horizon...which is supposed to be more 'advanced....'. I've decided just to add all the project related artwork to the project page instead for now..until someone fixes it permanently in the theme for everyone to use 🙂
There does seems to be a problem with the horizon theme the metafield doesn't seem to show or may be just may be we are missing something.
There's also no way setting it from the search and discovery app since we can only created complementary products for a particular product and not blog posts. One thing i feel a bug in the theme is in the related products section or product block inside it, it allows to select just a single product, it should be allowed that we could select multiple products.
Anyways after all this there's one way this seems to be done is custom code. I created a blog post metafield and with a for loop was able to traverse and display products selected from the blog post metafield field. So we could create our own section with these dynamically populated values.
Best
Shadab