html
{% set bg_color = section.settings.bg_color | default("#ffffff") %}
{% set text_color = section.settings.text_color | default("#333333") %}
{% set pad_y = section.settings.padding_y | default(60) %}
<section id="jw-section-{{ section.id }}" style="background-color: {{ bg_color }}; padding: {{ pad_y }}px 20px;">
<div class="jw-container" data-id="{{ section.id }}">
<div class="text-center mb-5">
<h2 class="fontStyle2" style="color: {{ text_color }};">{{ section.settings.title | default('Featured Products') }}</h2>
</div>
{# PRODUCT LOOP #}
{% if products %}
<div class="row g-4 {% if products | length < 3 %}justify-content-center{% endif %}">
{% for product in products %}
<div class="col-lg-3 col-md-4 col-sm-6">
<div class="card h-100 border-0 shadow-sm product-card position-relative" style="border-radius: 12px; overflow: hidden;">
{# RIBBON / TAG #}
{% if product.ribbon %}
<div class="position-absolute top-0 start-0 m-3 z-index-1">
<span class="badge bg-danger fontStyle9 py-1 px-2">{{ product.ribbon }}</span>
</div>
{% endif %}
{# DISCOUNT TAG #}
{% if product.discount %}
<div class="position-absolute top-0 start-0 m-3 mt-5 z-index-1">
<span class="badge bg-success fontStyle9 py-1 px-2">{{ product.discount }}</span>
</div>
{% endif %}
{# WISHLIST TOGGLE (CORE CRM LINKED) #}
<div class="position-absolute top-0 end-0 m-3 z-index-1">
<div class="jw-wishlist-toggle wishlist-icon bg-white rounded-circle d-flex align-items-center justify-content-center shadow-sm"
style="width: 35px; height: 35px; cursor: pointer; color: #ff4757;"
onclick="customWishlist('custom','{{product.default_varient}}',this);">
<i class="fa-regular fa-heart"></i>
</div>
</div>
{# PRODUCT MEDIA #}
<a href="{{ product.url }}" class="d-block position-relative" style="height: 250px; background-color: #f8f9fa;">
<img src="{{ product.cover }}" alt="{{ product['cover.alt'] | default(product.title) }}"
class="primary-img w-100 h-100 object-fit-cover"
onerror="this.onerror=null; this.src='https://images.unsplash.com/photo-1505740420928-5e560c06d30e?auto=format&fit=crop&w=800&q=80';">
{% if product.media %}
<img src="{{ product.media }}" alt="{{ product['media.alt'] | default('hover image') }}"
class="hover-img position-absolute top-0 left-0 w-100 h-100 object-fit-cover opacity-0 transition-base"
onerror="this.onerror=null; this.style.display='none';">
{% endif %}
</a>
{# PRODUCT INFO #}
<div class="card-body text-center p-3">
<h5 class="card-title fontStyle6 mb-2">
<a href="{{ product.url }}" style="color: {{ text_color }}; text-decoration: none;">{{ product.title }}</a>
</h5>
<div class="price-wrapper d-flex justify-content-center gap-2 fontStyle7 mb-3">
{% if product.sale_price %}
<span class="fw-bold text-dark">{{ site.currency }}{{ product.sale_price }}</span>
{% endif %}
{% if product.price %}
<span class="text-muted text-decoration-line-through">{{ site.currency }}{{ product.price }}</span>
{% endif %}
</div>
{# ADD TO CART (CORE CRM LINKED) #}
{% if product.in_stock %}
<button class="btn btn-outline-dark w-100 fontStyle8" onclick="JWCart.add('redirect', '{{product.default_varient}}', 1)">
Add to Cart
</button>
{% else %}
<button class="btn btn-secondary w-100 fontStyle8" disabled>
Out of Stock
</button>
{% endif %}
</div>
</div>
</div>
{% endfor %}
</div>
{% else %}
<div class="text-center py-5">
<p class="text-muted fontStyle7">No products available.</p>
</div>
{% endif %}
</div>
</section>
<style>
/* Product Card Hover Effects */
.product-card .hover-img {
transition: opacity 0.3s ease;
}
.product-card:hover .hover-img {
opacity: 1 !important;
}
.product-card:hover .primary-img {
opacity: 0;
}
.transition-base {
transition: all 0.3s ease;
}
</style>
{% rules %}
{
"name": "E-Commerce Product Feed",
"type": "ProductFeed",
"blocks": [
{ "type": "themes" },
{ "type": "apps" }
],
"settings": [
{
"type": "text",
"id": "title",
"label": "Section Title",
"default": "Featured Products"
},
{
"type": "color_background",
"id": "bg_color",
"label": "Background Color",
"default": "#ffffff"
},
{
"type": "color",
"id": "text_color",
"label": "Text Color",
"default": "#333333"
},
{
"type": "range",
"id": "padding_y",
"label": "Vertical Padding",
"min": 0,
"max": 150,
"step": 10,
"unit": "px",
"default": 60
}
],
"presets": []
}
{% endrules %}