How to show a metafield "related_blog_post" on product page?

I created a metafield “related_blog_post” which contains URL of related blog post to that product, I want to show that on product page.

Either by block, button or text, through which we can jump to related blog post…

www.crazygen.in

Hi @CrazyGen_IN

1、

2、

3、


                  {%- if product.metafields.custom.related_blog_post != blank -%}
                    {% assign metaobject_data = product.metafields.custom.related_blog_post.value %}
                    {% if metaobject_data %}
                      

Product Introduction

                    {% endif %}
                  {% endif %}
                

Hi @CrazyGen_IN ,

Please go to Customize > Product information > Add block > Custom Liquid and add code:

Code:

Link blog

@CrazyGen_IN Please follow below steps to show the metafield “related_blog_post” on product page.

  1. From admin go to “Online Store” → “Themes”.
  2. Click “Customize” button form the current theme.
  3. Go to product page.
  4. Click add block under the product information section and select the “Custom Liquid” block.

  1. Paste the below code in the custom liquid section as like below screenshot.

  
    See blog
  

FYI: If you are using multiple product templates, you need to add the custom liquid block in all the templates.

  1. Result will be,

Please provide your support by click “Like” and “Accepted” if our solution works for you. Thanks for your support.

1 Like