Does someone know how to show the product subtitle (which I included as a Metafield) in the collections or home page as well?
So far it’s just showing in the product page, but I’d like to have the subtitle also displayed everywhere the product is shown.
Hi @integerwellness
You can show them like this
{{product.metafields.namespace.key}} where
product → product object
namespace → metafield namespace
key → metafield key
Thanks!
I don’t understand the suggestion. Is this coding? I have created the metafields and they show on the product page but i want it on the featured collection as well
Yes, it is liquid code
The change you are requesting will be possible through liquid code
Where am i to place the liquid code?
The place where you want to put your sub-title
For product cards
The file will be something like this, product-card.liquid or poduct-item.liquid or similar and exact metafield code you can copy from the place where you defined the metafields (normally under Settings → content). But please update product with product object. In some of the themes on product cards, it is card_product instead of product
It is still not working for my store. I’m not sure if I’m not coding correctly but it still only shows on my product page
Hey @integerwellness Please share your store URL and metafield name you have created based on that I can share the code which you have to implement in the code file.
Hello!
https://integerwellness.com/
I have created a metafield which could be wrong but its a product subtitle
Hi,
If you are having issue in implementing this code then you can send me collaborator request and I can add it for you
Thanks!
I would be happy to. how do i do that?
I just sent request, please accept to continue
Hi,
I fixed it, please check now
Thanks!
Hi,
I am posting solution here so that it can be beneficial for others as well.
It was Refresh theme and product grid code was in snippets/card-product.liquid file.
To show subtitle,
I added this code
{% if card_product.metafields.descriptors.subtitle %}
### {{ card_product.metafields.descriptors.subtitle.value }}
{% endif %}
at Line: 158
Thanks!