You may also like / minimal theme shopify

Hello , I’m a new user of shopify, I have a problem with the poduct recommendations section when I activate it it doesn’t show any product. Can anyone give a solution. Thanks !

1 Like

@badresd

can you please send store url

https://help.shopify.com/en/manual/online-store/themes/themes-by-shopify/vintage-themes/minimal/sections#product-recommendations

1 Like

https://aesthesight.myshopify.com/

Password : reablu

1 Like

@badresd

code doesn’t generate bt not show

can you download fresh theme

yes, please add this code

https://shopify.github.io/liquid-code-examples/example/product-recommendations

{%- if section.settings.show_product_recommendations -%}
  
    {%- if recommendations.products_count > 0 -%}
      ## You may also like
      
        {%- for product in recommendations.products -%}
        - {{ product.title }}

            

  {{ product.price | money}}

          
        
        {%- endfor -%}
      

    {%- endif -%}
  

{%- endif -%}

{% schema %}
{
  "name": "Product recommendations",
  "settings": [
    {
      "type": "checkbox",
      "id": "show_product_recommendations",
      "label": "Enable product recommendations",
      "default": false
    }
  ]
}
{% endschema %}

{% javascript %}
var loadProductRecommendationsIntoSection = function() {
  // Look for an element with class 'product-recommendations'
  var productRecommendationsSection = document.querySelector(".product-recommendations");
  if (productRecommendationsSection === null) { return; }
  // Read product id from data attribute
  var productId = productRecommendationsSection.dataset.productId;
  // Read limit from data attribute
  var limit = productRecommendationsSection.dataset.limit;
  // Build request URL
  var requestUrl = "/recommendations/products?section_id=product-recommendations&limit="+limit+"&product_id="+productId;
  // Create request and submit it using Ajax
  var request = new XMLHttpRequest();
  request.open("GET", requestUrl);
  request.onload = function() {
    if (request.status >= 200 && request.status < 300) {
      var container = document.createElement("div");
      container.innerHTML = request.response;
      productRecommendationsSection.parentElement.innerHTML = container.querySelector(".product-recommendations").innerHTML;
    }
  };
  request.send();
};
// If your section has theme settings, the theme editor
// reloads the section as you edit those settings. When that happens, the
// recommendations need to be fetched again.
// See https://help.shopify.com/en/themes/development/sections/integration-with-theme-editor
document.addEventListener("shopify:section:load", function(event) {
  if (event.detail.sectionId === "product-recommendations") {
    loadProductRecommendationsIntoSection();
  }
});
// Fetching the recommendations on page load
loadProductRecommendationsIntoSection();
{% endjavascript %}
1 Like

I need it in the Minimal theme please, I’ve tried using (dawn, debut,…) themes but same problem. I tried using other themes and the Recomandation product section does not appear on the product page. I don’t know what the problem is, do I need to receive the plan then it will appear or what?

Thanks @KetanKumar for replying !