Adding a metafield to product card in collections

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 Partner
3478 465 558

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, marking it as a solution, or donating here .


Product Labels by BSS | B2B Solution & Custom Pricing


Need help from our expert? Kindly share your request with us via community@bsscommerce.com


BSS Commerce - Full-service eCommerce Agency

View solution in original post

Replies 7 (7)

BSS-Commerce
Shopify Partner
3478 465 558

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, marking it as a solution, or donating here .


Product Labels by BSS | B2B Solution & Custom Pricing


Need help from our expert? Kindly share your request with us via community@bsscommerce.com


BSS Commerce - Full-service eCommerce Agency
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 Partner
3478 465 558

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, marking it as a solution, or donating here .


Product Labels by BSS | B2B Solution & Custom Pricing


Need help from our expert? Kindly share your request with us via community@bsscommerce.com


BSS Commerce - Full-service eCommerce Agency
valholden02
Shopify Partner
22 0 10

This was a huge help! Thank you! 

Lisa_Bulpin
Excursionist
34 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. 

LambdaServices
Shopify Partner
4 0 0

Hi there, I know I'm late to this thread but it is still very relevant!

 

I have used your code to add in my meta field to the product card however it was added it in with [" "] around the text used in the metafield - is there a way to remove this? Also, how would I go about styling this with CSS?

LambdaServices
Shopify Partner
4 0 0

For the nesting special characters, I have found the solution in another thread for anyone looking for it:

{{ card_product.metafields.custom.fragrance | metafield_text }}