How can I fix the liquid error on my product recommendations?

Topic summary

A user encountered a “Liquid error (sections/product-recommendations.liquid line 25): internal” when enabling Product Recommendations on their product page using the Dawn 2.0 theme.

Root Cause Identified:
The issue stems from stores having insufficient collections or products linked to collections. The recommendation engine requires properly configured collections with associated products to function.

Two Working Solutions:

  1. Add Collections & Products: Create new collections and link products to them. Once collections are properly populated (beyond just homepage/all handles), the recommendation module starts working correctly.

  2. Code Fix: Modify the product-recommendations.liquid file by changing:

    if recommendations.performed and recommendations.products_count > 0
    

    to:

    if recommendations.performed? and recommendations.products_count > 0
    

    Adding the ? after recommendations.performed resolves the error.

Additional Context:
Multiple users confirmed experiencing this identical issue across different Dawn theme versions. The problem appears to be a common pattern in most Shopify themes. Both solutions have been verified as effective by community members.

Summarized with AI on November 6. AI used: claude-sonnet-4-5-20250929.

Hello,

I am trying to turn on Product Recommendations on my Product Page and I’m getting this error below.

→ Liquid error (sections/product-recommendations.liquid line 25): internal

I’m not technical, so could really use some help figuring out what’s going on with it. Thank you so much!

Website: www.trykindred.com

Product Page: https://www.trykindred.com/products/one-kindred-documentary-video

Theme: Dawn 2.0

@mattmark

oh sorry i can’t see can you please enable that section so i will check and let you know

Hey @KetanKumar !

I believe I do have the Product Recommendations block enabled on this page right now. Here’s a screenshot of what I see in my editor. It just shows this liquid error while in the editor (sometimes, it’s a little sporadic) and doesn’t appear at all on the page.

1 Like

@mattmark

can you please send

Product Recommendations section code

@KetanKumar here’s the code from the Sections → product-recommendations.liquid area of my theme’s code.


{%- style -%}
  .section-{{ section.id }}-padding {
    padding-top: {{ section.settings.padding_top | times: 0.75 | round: 0 }}px;
    padding-bottom: {{ section.settings.padding_bottom | times: 0.75 | round: 0 }}px;
  }

  @media screen and (min-width: 750px) {
    .section-{{ section.id }}-padding {
      padding-top: {{ section.settings.padding_top }}px;
      padding-bottom: {{ section.settings.padding_bottom }}px;
    }
  }
{%- endstyle -%}

  

{% javascript %}
  class ProductRecommendations extends HTMLElement {
    constructor() {
      super();

      const handleIntersection = (entries, observer) => {
        if (!entries[0].isIntersecting) return;
        observer.unobserve(this);

        fetch(this.dataset.url)
          .then(response => response.text())
          .then(text => {
            const html = document.createElement('div');
            html.innerHTML = text;
            const recommendations = html.querySelector('product-recommendations');

            if (recommendations && recommendations.innerHTML.trim().length) {
              this.innerHTML = recommendations.innerHTML;
            }

            if (html.querySelector('.grid__item')) {
              this.classList.add('product-recommendations--loaded');
            }
          })
          .catch(e => {
            console.error(e);
          });
      }

      new IntersectionObserver(handleIntersection.bind(this), {rootMargin: '0px 0px 200px 0px'}).observe(this);
    }
  }

  customElements.define('product-recommendations', ProductRecommendations);
{% endjavascript %}

{% schema %}
{
  "name": "t:sections.product-recommendations.name",
  "tag": "section",
  "class": "section",
  "settings": [
    {
      "type": "paragraph",
      "content": "t:sections.product-recommendations.settings.paragraph__1.content"
    },
    {
      "type": "text",
      "id": "heading",
      "default": "You may also like",
      "label": "t:sections.product-recommendations.settings.heading.label"
    },
    {
      "type": "select",
      "id": "heading_size",
      "options": [
        {
          "value": "h2",
          "label": "t:sections.all.heading_size.options__1.label"
        },
        {
          "value": "h1",
          "label": "t:sections.all.heading_size.options__2.label"
        },
        {
          "value": "h0",
          "label": "t:sections.all.heading_size.options__3.label"
        }
      ],
      "default": "h1",
      "label": "t:sections.all.heading_size.label"
    },
    {
      "type": "range",
      "id": "products_to_show",
      "min": 2,
      "max": 10,
      "step": 1,
      "default": 4,
      "label": "t:sections.product-recommendations.settings.products_to_show.label"
    },
    {
      "type": "range",
      "id": "columns_desktop",
      "min": 1,
      "max": 5,
      "step": 1,
      "default": 4,
      "label": "t:sections.product-recommendations.settings.columns_desktop.label"
    },
    {
      "type": "select",
      "id": "color_scheme",
      "options": [
        {
          "value": "accent-1",
          "label": "t:sections.all.colors.accent_1.label"
        },
        {
          "value": "accent-2",
          "label": "t:sections.all.colors.accent_2.label"
        },
        {
          "value": "background-1",
          "label": "t:sections.all.colors.background_1.label"
        },
        {
          "value": "background-2",
          "label": "t:sections.all.colors.background_2.label"
        },
        {
          "value": "inverse",
          "label": "t:sections.all.colors.inverse.label"
        }
      ],
      "default": "background-1",
      "label": "t:sections.all.colors.label",
      "info": "t:sections.all.colors.has_cards_info"
    },
    {
      "type": "header",
      "content": "t:sections.product-recommendations.settings.header__2.content"
    },
    {
      "type": "select",
      "id": "image_ratio",
      "options": [
        {
          "value": "adapt",
          "label": "t:sections.product-recommendations.settings.image_ratio.options__1.label"
        },
        {
          "value": "portrait",
          "label": "t:sections.product-recommendations.settings.image_ratio.options__2.label"
        },
        {
          "value": "square",
          "label": "t:sections.product-recommendations.settings.image_ratio.options__3.label"
        }
      ],
      "default": "adapt",
      "label": "t:sections.product-recommendations.settings.image_ratio.label"
    },
    {
      "type": "checkbox",
      "id": "show_secondary_image",
      "default": false,
      "label": "t:sections.product-recommendations.settings.show_secondary_image.label"
    },
    {
      "type": "checkbox",
      "id": "show_vendor",
      "default": false,
      "label": "t:sections.product-recommendations.settings.show_vendor.label"
    },
    {
      "type": "checkbox",
      "id": "show_rating",
      "default": false,
      "label": "t:sections.product-recommendations.settings.show_rating.label",
      "info": "t:sections.product-recommendations.settings.show_rating.info"
    },
    {
      "type": "header",
      "content": "t:sections.product-recommendations.settings.header_mobile.content"
    },
    {
      "type": "select",
      "id": "columns_mobile",
      "default": "2",
      "label": "t:sections.product-recommendations.settings.columns_mobile.label",
      "options": [
        {
          "value": "1",
          "label": "t:sections.product-recommendations.settings.columns_mobile.options__1.label"
        },
        {
          "value": "2",
          "label": "t:sections.product-recommendations.settings.columns_mobile.options__2.label"
        }
      ]
    },
    {
      "type": "header",
      "content": "t:sections.all.padding.section_padding_heading"
    },
    {
      "type": "range",
      "id": "padding_top",
      "min": 0,
      "max": 100,
      "step": 4,
      "unit": "px",
      "label": "t:sections.all.padding.padding_top",
      "default": 36
    },
    {
      "type": "range",
      "id": "padding_bottom",
      "min": 0,
      "max": 100,
      "step": 4,
      "unit": "px",
      "label": "t:sections.all.padding.padding_bottom",
      "default": 36
    }
  ]
}
{% endschema %}
1 Like

this code update can you please download fresh theme and check this

Hey @KetanKumar , I’m not sure what you mean. Do I need to update my theme? If so, I don’t see a notification where it should be that there’s an update available (referencing this article). Or do I go to Actions → Download Theme File? Or something else?

Thank you for your continued help on this!

Hey @KetanKumar , I have the exact same problem with the latest version of Dawn (6.0.2). The problem is somewhere else. Even switching to another Theme leads to the same issue. I’ve never seen that before.

1 Like

@Max_Osos

can you please share store url and issue images?

Hey @mattmark , I guess you still have this problem? I solved mine last night thanks to:
https://shopify.dev/themes/product-merchandising/recommendations?shpxid=3959888d-4F48-4846-7318-2D07F3DED120#recommendation-logic
It was related to my collections. I had only two with the handles all and frontpage.
As soon as I added new collections and linked some products to them, the product recommendation module started to work properly.
As far as I see, your website has no collection at all. That must be the reason. :slightly_smiling_face:
Let us know.
Cheers,
Max

1 Like

@KetanKumarProblem solved !!! :slightly_smiling_face: (see answer to mattmark above). Thanks again.

Hey, just to note: we had the same issue reported by the moderators of our store.

We have fixed it by changing:

if recommendations.performed and recommendations.products_count > 0

to:

if recommendations.performed? and recommendations.products_count > 0

It is just adding a ‘?’ after ‘recommendations.performed’ . This IF condition is pretty standard, so I guess it have to be this or at least something close to this in the most of the themes. I think, it is the same as @Max_Osos answer:

https://shopify.dev/docs/storefronts/themes/product-merchandising/recommendations/related-products