Why {{ recommendations.products_count }} returns 0 ? (product recommendations)

Hi,

I have successfully installed the product recommendations on product pages in the past, but this time it’s not working as {{ recommendations.products_count }} returns 0. Yet there are multiple products listed in the shop and online.

I have followed this tutorial : https://help.shopify.com/en/themes/development/recommended-products/using-liquid

There are no errors in the console and the dom content is there but empty :

2OHMOK6Rhs.png

What could be the possible reasons behind that? I am a bit clueless right now.

Regards,

Hi, I think the mechanism to calculate product recommendations from Shopify is based on your order and your product description. On a product page, they will display other products that frequently brought with the selected product. Let give it another try.

Thanks for your help Richard,

Actually I found the problem, which was documented in the “Recommendation logic”. The problem is I only had one collection named “page d’accueil” (Home page) and apparently :

If the product doesn’t have a collection URL, then the recommendation algorithm finds collections that include the product and pulls other products from those instead (excluding collections with handles “all” and “frontpage”)

So the “frontpage” handle was the issue. I created a new collection and populated the products in it and it works now.

Hope that helps anyone else in the future.

I tried adding another collection and populate it with the same items. It still didn’t work for me. When I make a getJSON request I get an empty products array. However, this works on another website. Any ideas what could I have done wrong or missed out?

I’m also having the same issues. I have many collections and it was working until about a week ago it stopped.

Development Site:
https://coastwoodfurniture.myshopify.com/recommendations/products.json?product_id=7376883384507

Password: coastwood

I reached out to Shopify and then said:

"Unfortunately, as Support Advisors, our knowledge on APIs is severely limited so we would always recommend that you reach out to our API and SDK forums .

Here, you can ask any questions you want and our team would be much better equipped to assist you with this."

No luck yet. :frowning:

That did it for me, thank you so much for sharing this @MaxDesign !

because this object isn’t populated when the section is initially rendered, so you need to use JavaScript to retrieve the populated section content through the section response of the Product Recommendations API. https://shopify.dev/docs/themes/product-merchandising/recommendations/complementary-products#implementing-complementary-products