How to add blog posts to product pages using metafields

Topic summary

Goal: link blog posts to product pages via metafields, instead of manually selecting posts in the product template.

Current capability: Shopify metafields do not offer a “blog post” reference type. You cannot define a metafield on products that directly links to an article. Dynamic sources on blog posts (added in 2023) let themes read metafields on posts, but they don’t enable linking posts to products.

Admin limitation: In metafield definitions, there’s no option to reference specific blog posts. The dynamic source picker on blog posts shows nothing relevant for product linking.

Workarounds (require Liquid theme code):

  • Product-centric: add a text metafield on the product to store the blog post handle or ID, then loop articles and render matches. Handle = the URL-friendly identifier; Liquid = Shopify’s templating language.
  • Reverse approach: add a metafield on blog posts pointing to target product(s), then loop blog posts and show those matching the current product.

Outcome/status: No native or streamlined admin setup. OP accepts the limitation but no official solution; the need remains open.

Summarized with AI on December 25. AI used: gpt-5.

When I am in a Product template, I am able to add blog posts. Set quantities, pick the post, no problem.

However, I want to do this through metafields.

When I go to the blog posts, I see I can connect a dynamic source, but when clicking on this, I don’t have anything.. which I understand, because I need to set those up.

However, when I create a metafield, I don’t see a way to connect it to the blog posts. Am I missing something?

1 Like

Hi @DutchDelight

Based on the information provided in the search results, it seems that currently there is no direct way to link blog posts to products using metafields in Shopify.

A few key points:

  1. Shopify’s metafields allow adding custom fields to products, collections, orders, customers, etc. However, there is no built-in “blog post” metafield type that would allow directly linking a blog post.

  2. When creating metafields, the option to reference or link to a specific blog post is not available in the metafield definition settings.

  3. In March 2023, Shopify released the ability to use dynamic sources on blog posts and articles, allowing theme files to connect to metafields.However, this is for displaying custom metafield data on the blog post itself, not for linking the blog post to a product.

  4. As a workaround, I would suggest:

  • Creating a text metafield on the product to store the blog post’s handle
  • Adding a metafield to the blog post containing the product ID
  • Then using Liquid code to loop through blog posts and render ones that match the product’s stored blog handle or ID.
  1. But there is no streamlined way to set this up directly through the Shopify admin metafield settings for products and blog posts.

In summary, the built-in metafields do not currently support a “blog post” reference type to easily link products and posts. The capability to connect dynamic sources to blog post templates is a recent addition, but does not address linking to products. Workarounds using Liquid code are possible but require more manual setup.

2 Likes

Can’t really accept it as a “Solution”, but it does answer my question.. Too bad it isn’t possible (yet).

You could possibly do it in reverse. Not ideal but works. You add a metafield to your blog post pointing to the product/s you would like it to feature on and then loop through blog posts where the metafield matches the current product.