Solved

Adding a metafield to product card in collections

atacox2
Visitor
2 0 0

Hi all,

 

Is there a way to add a meta field to the product cards on the collection page? I was hoping to add it above the price or alongside it. Picture for reference. Thanks in advance.

atacox2_1-1688668907167.png

 

 

Accepted Solution (1)
BSS-Commerce
Shopify Expert
3376 447 495

This is an accepted solution.

Hi @atacox2 ,

Make sure that you have written the metafield correctly.

 

view (45).png

You can watch the video to see how:

DEV Thuyen NA Store · Products · 5 Pocket Jean · Shopify - 11 July 2023 (loom.com)

 

If our suggestions are useful, please let us know by giving it a like or marking it as a solution.

For B2B solutions and custom pricing, check out B2B Solution & Custom Pricing |
For adding product labels/badges, visit Product Labels by BSS

BSS Commerce - Shopify Apps & Store Development Service Provider

Hire a Shopify expert | Shopify Plus Store Development

View solution in original post

Replies 5 (5)

BSS-Commerce
Shopify Expert
3376 447 495

Hi @atacox2 ,

Please follow these steps:

 

- Online Store => Themes => Edit code

- Find the file card-product.liquid

- Find the code

{% render 'price', product: card_product, price_class: '' %}

- Add the metafiled you want to display below the above code similar to the following example:

{{ card_product.metafields.custom.tex }}

 The above code will display the "tex" metafield

 

view (37).png

- Will display on the page as "123"

 

Result:

view (38).png

Note:

With metafield product.metafields.custom.tex will correspond to the code when added to the card-product.liquid file is {{ card_product.metafields.custom.tex }}

If our suggestions are useful, please let us know by giving it a like or marking it as a solution.

For B2B solutions and custom pricing, check out B2B Solution & Custom Pricing |
For adding product labels/badges, visit Product Labels by BSS

BSS Commerce - Shopify Apps & Store Development Service Provider

Hire a Shopify expert | Shopify Plus Store Development

atacox2
Visitor
2 0 0

I'm inputting the below and did so with .tex and neither worked

 

{%- endif -%}
{% render 'price', product: product_card_product, price_class: '' %}
{{ card_product.metafields.CAcademy.course_hours.text }}
</div>
</div>

 

Am I missing something?

BSS-Commerce
Shopify Expert
3376 447 495

This is an accepted solution.

Hi @atacox2 ,

Make sure that you have written the metafield correctly.

 

view (45).png

You can watch the video to see how:

DEV Thuyen NA Store · Products · 5 Pocket Jean · Shopify - 11 July 2023 (loom.com)

 

If our suggestions are useful, please let us know by giving it a like or marking it as a solution.

For B2B solutions and custom pricing, check out B2B Solution & Custom Pricing |
For adding product labels/badges, visit Product Labels by BSS

BSS Commerce - Shopify Apps & Store Development Service Provider

Hire a Shopify expert | Shopify Plus Store Development

valholden02
Shopify Partner
7 0 0

This was a huge help! Thank you! 

Lisa_Bulpin
Excursionist
33 0 11

Hello.  What do you do if you don't have a product card liquid in your theme?  I'm trying to do the same thing but not having any luck. 

I have created some product metafields I want added under the product title in the product collection  list.