How to add a metafield to a product card next to the vendor - 2.0 Theme

Hi Shopify Community,

I’m working on this store (pw: skeibu) and thought I’d reach out for some help! I’m wondering how I can add 2 meta fields to a product card to display right next to the vendor under the product title. Thanks in advance for looking into this and helping out!

Details: This Should apply to a specific collection page (collection: in-stock-hot-tubs) or alternatively can be just set up as a general for all product cards as well. The meta fields I’m trying to display are:

product.metafields.my_fields.number_of_people (eg output: 6 people)
product.metafields.my_fields.number_of_jets (eg output: 60 jets)

Thanks again!

Hi @tanithecreative ,

Please go to card-product.liquid file and change code here:

Code:


                
{{ card_product.vendor }}

                {%- if card_product.metafields.my_fields.number_of_people != blank -%}
                  {{ card_product.metafields.my_fields.number_of_people }}

                {%- endif -%}
                {%- if card_product.metafields.my_fields.number_of_jets != blank -%}
                  {{ card_product.metafields.my_fields.number_of_jets }}

                {%- endif -%}
              

So when products don’t enter Metafields, it won’t show, this helps you to manage things better with tag or collection.

Hope it helps!