{% extends 'shop/_layouts/main' %} {% block main %} {% for product in craft.commerce.products.limit(5).find() %}
{% include "shop/_images/product" with { class: 'u-max-full-width' } %}
{% if product.url %}{{ product.link }}{% else %}{{ product.title }}{% endif %}
{% if product.variants|length %}
{{ getCsrfInput() }} {% if product.unlimitedStock or (product.unlimitedStock == false and product.totalStock > 0 ) %} {% else %} {{ "Out of Stock"|t }} {% endif %}
{% if currentUser %} {% set order = craft.commerce.orders.user(currentUser).hasPurchasables(product.defaultVariant).find() %} {% if order|length %} I already own this product: Order #{{ order[0].shortNumber }} {% endif %} {% endif %} {%- for purchasable in product.variants -%} {%- endfor -%} {% endif %}
{% endfor %} {% includejs %} $( ".purchasableId" ).change(function(e) { $(".purchasableInfo").hide(); $("#"+($(this).find(":selected").data('info'))).toggle(); }); {% endincludejs %} {% endblock %}