Shopify linking product using SEO handle coding

Viewed 60

I followed the directions for the second way to tag a product to a blog

This is the website I used https://happypoints.io/shopify-add-products-to-blog-post-c2-stt-66/ This is the code that was entered {% assign my_description = article.content | split: '=== split content ===' %}

 {% assign  my_description_size = my_description.size | minus: 2 %}
  {{ my_description | first}}
 <div class="show-product-list">           
   {% if article.tags.size > 0 %}             
       {% for tag in article.tags %}
       {% paginate collections.all.products by 100 %}
       {%- for product in collections.all.products -%}
           {% if product.handle == tag %}
              <div class="product_item">
               {% include 'product-card-list' %} 
             </div> 
           {% endif %}
       {%- endfor -%}
       {% endpaginate %} 
       {% endfor %}          
   {% endif %}
 </div>
   {{ my_description | last}}

after following all the directions I received an error message saying

Liquid error (sections/article-template.liquid line 42): Could not find asset snippets/product-card-list.liquid

I am not sure why the product wont link to the blog using the seo handle. I have copied and pasted this code correctly and still getting this error

Collection code:

{% if collection.title == blank %}
  {% assign collection_image = blank %}
{% elsif collection.image %}
  {% assign collection_image = collection.image %}
{% else %}
  {% assign collection_image = collection.products.first.featured_media.preview_image %}
{% endif %}

{% unless collection.title == blank %}
  {% include 'card-image', type: collection_image, grid_style: grid_style %}
{% else %}
  <div class="card__image-wrapper">
    {% capture current %}{% cycle 1, 2, 3, 4, 5, 6 %}{% endcapture %}
    {{ 'collection-' | append: current | placeholder_svg_tag: 'placeholder-svg' }}
  </div>
{% endunless %}

<div class="card__info">
  <h3 class="card__name h4">{% if collection.title != blank %}{{ collection.title }}{% else %}{{ 'homepage.onboarding.collection_title' | t }}{% endif %}</h3>

  {% if section.settings.show_description and collection.description != blank %}
    <div class="rte card__description{% if width == '2' %} card__description--padding{% endif %}">
      {{ collection.description | strip_html | truncatewords: 15 }}
    </div>
  {% endif %}
</div>
1 Answers

You have correctly copy/pasted the code. The problem is that your theme does not have a file named "product-card-list" in the snippets folder. This is the file which contains code for the product tiles on the collection pages and the name for this file might differ in the theme that you're using. You will need to find out the correct file name and replace "product-card-list" with that. Can help you further if you share the code in your collection.liquid file.

Related