How to add metafield under title in product-card.liquid

How to add metafield under title in product-card.liquid

julian71
Visitor
2 0 1

Hi everyone,

I would love to add metafield (name of material) under title in product grid (yellow underline):

julian71_1-1634935473671.png

And this is the code (product-card.liquid). now instead of my metafield there is blank space.

julian71_2-1634935542052.png

 I would appreciate any help!

 

Replies 6 (6)

JohnFromJotting
Shopify Partner
665 94 133

Hi @julian71 

first you are missing ">" in "<a" which is why </a> is red.

Second I assume you created the metafield from shopify metafield creator? Did you add the materials in the shopify product section?

 

Bluish_0-1634939883737.png

 

Check out my blog for some awesome Shopify, SEO and Social Media Marketing content.


To hire me, visit my Upwork profile

julian71
Visitor
2 0 1

Thanks for answering. Yes, I created it from an app, but I added it to product section too.

TWBF
Shopify Partner
15 0 4

Where you able to resolve this? 

Shamu450
Visitor
2 0 3

@julian71 @TWBF @JohnFromJotting  Not sure if you figured it out yet, but I was able to display a metafield on the collections page and featured collections block product card by using product_card_product instead of product, so the metafield in the post it would be

 

 

 

{{ product_card_product.metafields.name.material }}

 

 

Hope this helps!

holidays
Shopify Partner
1 0 2

This works but without the first 'product' so just {{ card_product.metafields.name.material }}. 

 

Good luck

Ephraim_
Shopify Partner
2 0 0

I can confirm that @Shamu450 and @holidays code works.

 

1. Create a product metafield

2. Fill out the field for your desired product pages

3. include the following code in your theme's version of the file snippet 'card-product.liquid' 

 

{{ card_product.metafields.name.material }}

 

I was having trouble displaying product metafields on non-product pages and this was the solution I was looking for.