Cavefish
Cavefish

Reputation: 53

Liquid Shopify - Display specific products on custom landing page

Is it possible to write a loop where I can display specific products that belong to different collections on a custom liquid landing page (e.g., filename templates\page.[page-title].liquid)?

Here is an example of my loop:

<div id="recommended-products">
    <!-- Begin loop with specific products (Perhaps by id?) -->
        <div class="product-card">
            <div class="product-card__title">{{ product.title | escape  }}</div>
            <div class="product-card__price">
                {% if product.price_varies %}
                    {{ product.price_min | money }} - {{ product.price_max | money }}
                {% else %}
                    {{ product.price | money }}
                {% endif %}
            </div>
        </div>
    <!-- End loop -->
</div>

Thank you for you time.

Upvotes: 0

Views: 1624

Answers (1)

Jaswinder Kaur
Jaswinder Kaur

Reputation: 1634

Shopify Select Any Product Block Code

{%- for block in section.blocks -%}
{%- assign product = block.settings.product -%}
<img src="{{ product.featured_image | img_url: 'master' }}">
<div class="Product_detail">
 {{ product.title | escape }}
{% render 'price', product: product, price_class: '' %}
</div>
{%- endfor -%}

{% schema %}
  {
    "name": "product",
    "settings": [],
  "blocks": [
    {
      "type": "Product",
      "name": "Product block",
      "settings": [
        {
      "type": "product",
      "id": "product",
      "label": "t:sections.featured-product.settings.product.label"
        }
    ]

    }
  ],
  "presets": [
    {
      "name": "products"
    }
  ]
  }
{% endschema %}

Upvotes: 1

Related Questions