Shopify themes, liquid, logos, and UX
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...
Hi @CrazyGen_IN
1、
2、
3、
<div style="text-transform: uppercase;">
{%- if product.metafields.custom.related_blog_post != blank -%}
{% assign metaobject_data = product.metafields.custom.related_blog_post.value %}
{% if metaobject_data %}
<p><a href="{{ metaobject_data }}">Product Introduction</a></p>
{% endif %}
{% endif %}
</div>
Hi @CrazyGen_IN,
Please go to Customize > Product information > Add block > Custom Liquid and add code:
Code:
<a href="{{ product.metafields.custom.related_blog_post }}">Link blog</a>
@CrazyGen_IN Please follow below steps to show the metafield "related_blog_post" on product page.
<div class= "metafield_value">
<a href="{{ product.metafields.custom.related_blog_post.value }}" class="related_blog_post_btn">
See blog
</a>
</div>
<style>
.product__info-wrapper .metafield_value .related_blog_post_btn {
padding: 7px 12px;
background-color: #000;
color: #ffffff;
border: solid 1px #000000;
text-decoration: none;
border-radius: 2px;
font-size: 17px;
display: flex;
justify-content: center;
}
</style>
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025