{% assign collection_products = section.settings.collection.products %} {% if collection_products.size > 0 %}

All Categories > {{ section.settings.collection.title }} ({{ collection_products.size }} {{ collection_products.size | pluralize: 'product', 'products' }})

{% for product in collection_products %}

{{ product.title }}

{{ product.description | strip_html | truncatewords: 30 }}

{% if product.featured_image %} {{ product.featured_image | image_url: width: 100 | image_tag: alt: product.featured_image.alt }} {% endif %}
{% if product.options[1] %} {% endif %} {% for variant in product.variants %} {% if variant.option2 %} {% endif %} {% endfor %}
SKU {{ product.options[0] }}{{ product.options[1] }}Model Net Weight Each Buy
{{ variant.sku }} {{ variant.option1 }}{{ variant.option2 }}{{ variant.title }} {{ variant.weight | default: 'N/A' }}g {{ variant.price | money }}
{% endfor %}
{% endif %} {% stylesheet %} .desktop-only { display: none; } @media (min-width: 768px) { .desktop-only { display: table-cell; } } .product-collection { font-family: Arial, sans-serif; } .collection-title { font-size: 24px; margin-bottom: 10px; } .product-count { font-size: 14px; margin-bottom: 20px; } .product-container { margin-bottom: 20px; padding: 10px; position: relative; } .hash-handle { visibility: hidden; top: -35px; position: absolute; } .product-title { font-size: 18px; color: green; } .product-description { font-size: 12px; } .product-details { display: flex; align-items: center; margin-bottom: 10px; } .image-placeholder { width: 100px; height: 100px; margin-right: 10px; } .image-placeholder img { width: 100%; height: auto; object-fit: cover; } .variant-table { width: 100%; border-collapse: collapse; } th, td { text-align: left; /* Left-align headers and cells */ padding: 4px; /* Tighter line height */ font-size: 12px; } .variant-row:hover { background-color: #fff5b1; /* Pale yellow background on hover */ } .add-to-cart-form input[type='number'] { width: 2rem; } .added-button { display: none; } {% endstylesheet %} {% javascript %} document.addEventListener('DOMContentLoaded', function () { // Dynamically add items to the cart without reloading the page document.querySelectorAll('.add-to-cart-form').forEach((form) => { form.addEventListener('submit', function (event) { event.preventDefault(); const formData = new FormData(form); fetch(window.Shopify.routes.root + 'cart/add.js', { method: 'POST', body: formData, }) .then((response) => response.json()) .then((data) => { form.querySelector('.add-button').style.display = 'none'; form.querySelector('.added-button').style.display = 'inline-block'; setTimeout(() => { form.querySelector('.added-button').style.display = 'none'; form.querySelector('.add-button').style.display = 'inline-block'; }, 2000); // Update the cart item count in the page header fetch(window.Shopify.routes.root + 'cart.js', { method: 'GET', }) .then((response) => response.json()) .then((cart) => { document.querySelector('#cart-item-count').textContent = cart.items.length; }); }) .catch((error) => { console.error('Error adding item to cart:', error); }); }); }); }); {% endjavascript %} {% schema %} { "name": "Single Collection View", "class": "section", "tag": "section", "disabled_on": { "groups": ["header", "footer"] }, "settings": [ { "type": "collection", "id": "collection", "label": "Collection" } ] } {% endschema %}