How to add a product sidebar to Shopify Blog Posts

abstract colourful wave

Having a sidebar showcasing products next to your Shopify blog posts is a great way to increase conversions and keep your audience engaged. This guide explains clearly how to add a product sidebar to your blog posts, ensuring your readers have easy access to products relevant to your content.

How to Do It (Step-by-Step)

Using Shopify’s Metafields and Theme Editor

  1. Set Up Metafields:
    • Go to your Shopify Admin and select Settings > Custom Data > Articles.
    • Create a new metafield called Recommended Products, choosing Product List as the content type.
  2. Select Products for Blog Posts:
    • When editing your blog posts, scroll down to the metafield section.
    • Select relevant products for each blog post and save your changes.
  3. Edit Your Theme to Display Products:
    • Navigate to Online Store > Themes.
    • Click Actions > Edit code.
    • Open the article-template.liquid or equivalent file.
    • Add the following code snippet to render products:
{% if article.metafields.custom.recommended_products %}
  <aside class="blog-sidebar">
    <h3>Featured Products</h3>
    {% for product in article.metafields.custom.recommended_products %}
      <div class="sidebar-product">
        <a href="{{ product.url }}">
          <img src="{{ product.featured_image | img_url: '200x' }}" alt="{{ product.title }}" />
          <p>{{ product.title }}</p>
          <p>{{ product.price | money }}</p>
        </a>
      </div>
    {% endfor %}
  </aside>
{% endif %}
  1. Style Your Sidebar:
    • Adjust your theme’s CSS to ensure the sidebar is visually appealing and responsive.

FAQs

Q: Can I have different products for each blog post?
A: Yes, using metafields allows you to assign unique product recommendations to each post.

Q: Will the sidebar display well on mobile devices?
A: Most themes automatically stack sidebars below the main content on mobile devices. Always preview and adjust CSS as needed.

Conclusion

Adding a product sidebar to your Shopify blog posts is straightforward, even though you might need to work on some coding challenge. Soon you will have an attractive, conversion-boosting blog sidebar ready to enhance your store’s performance.

Ready to scale your Shopify store?

From performance optimization to custom development, we help Shopify merchants grow faster. Let's discuss how we can improve your store's conversions and speed.