Ad

I Want To Add The Product From Collection Page Into Blog Page

- 1 answer

I have one question. How can I import the collection in Blog page?

{%- assign collection = collections[section.settings.collection] -%}
{% for product in collection.products limit: product_limit %}
      <div class="grid__item {{ grid_item_width }}">
        {% include 'product-card-grid', grid_image_width: image_size %}
      </div>
    {% endfor %}

I have tried above code, but it doesn't work. I want show the product in https://www.luxilash.com/collections/3dminklashes.

Ad

Answer

Well, I guess you did not set up the configuration for

section.settings.collection

In the page template. Are you sure section.settings.collection has the right value for your case?

For easy approach, please try following code snap instead:

{%- assign collection = collections['3dminklashes'] -%}
{% for product in collection.products limit: product_limit %}
      <div class="grid__item {{ grid_item_width }}">
        {% include 'product-card-grid', grid_image_width: image_size %}
      </div>
{% endfor %}

I just grabbed collection code from the URL you provided.

https://www.luxilash.com/collections/3dminklashes
Ad
source: stackoverflow.com
Ad