{%- comment -%}Color labels used to detect what is a color swatch{%- endcomment -%}
{%- assign color_label = 'color,colour,couleur,cor,colore,farbe,색,色,カラー,färg,farve,szín,barva' | split: ',' -%}
{%- capture product_labels -%}
{%- unless hide_labels -%}
{%- assign custom_badges = product.metafields.custom.badges.value -%}
{%- for badge in custom_badges -%}
{{ badge }}
{%- endfor -%}
{%- for tag in product.tags -%}
{%- if tag contains '__label:' -%}
{{ tag | split: '__label:' | last }}
{%- endif -%}
{%- if tag contains '__label1:' -%}
{{ tag | split: '__label1:' | last }}
{%- endif -%}
{%- if tag contains '__label2:' -%}
{{ tag | split: '__label2:' | last }}
{%- endif -%}
{%- endfor -%}
{%- if settings.show_discount and product.price < product.compare_at_price -%}
{%- if settings.discount_mode == 'percentage' -%}
{%- assign savings = product.compare_at_price | minus: product.price | times: 100.0 | divided_by: product.compare_at_price | round | append: '%' -%}
{%- else -%}
{%- capture savings -%}{{ product.compare_at_price | minus: product.price | money }}{%- endcapture -%}
{%- endif -%}
{{ 'collection.product.discount_html' | t: savings: savings }}
{%- endif -%}
{%- endunless -%}
{%- endcapture -%}
{%- if product_labels != blank -%}
{%- endif -%}
{%- endif -%}
{%- if settings.product_price_position == 'after_title' -%}
{{ price_list }}
{%- endif -%}
{%- if settings.show_reviews_badge -%}
{%- render 'product-rating', product: product -%}
{%- endif -%}
{%- if settings.show_inventory_quantity and product.variants.first.inventory_management != blank and product.template_suffix != 'pre-order' -%}
{%- if product.available -%}
{%- assign should_calculate_inventory = true -%}
{%- for variant in product.variants -%}
{%- comment -%}
If we have one variant that is set to "continue" or that do not have any inventory management, then we skip the calculation of inventory as this
means at least one of the variant is always purchasable
{%- endcomment -%}
{%- if variant.inventory_policy == 'continue' or variant.inventory_management == null -%}
{%- assign should_calculate_inventory = false -%}
{%- break -%}
{%- endif -%}
{%- endfor -%}
{%- if should_calculate_inventory and settings.low_inventory_threshold > 0 -%}
{%- assign all_inventory = 0 -%}
{%- for variant in product.variants -%}
{%- if variant.inventory_management -%}
{%- assign all_inventory = variant.inventory_quantity | at_least: 0 | plus: all_inventory -%}
{%- endif -%}
{%- endfor -%}
{%- if all_inventory <= settings.low_inventory_threshold -%}
{{ 'collection.product.low_stock_with_quantity_count' | t: count: all_inventory }}
{%- else -%}
{{ 'collection.product.in_stock_with_quantity_count' | t: count: all_inventory }}
{%- endif -%}
{%- else -%}
{%- if product.variants.first.inventory_policy == 'continue' and product.variants.first.inventory_quantity <= 0 and product.variants.first.requires_shipping -%}
{{ 'collection.product.oversell_stock' | t }}
{%- else -%}
{{ 'collection.product.in_stock' | t }}
{%- endif -%}
{%- endif -%}
{%- else -%}
{{ 'collection.product.sold_out' | t }}
{%- endif -%}
{%- endif -%}
{%- if request.page_type == 'collection' or request.page_type == 'search' or show_add_to_cart -%}
{%- if section.settings.show_quick_view == 'list_grid' or section.settings.show_quick_buy == 'list_grid' or show_add_to_cart -%}
{%- assign product_form_classes = 'product-item__action-list button-stack' -%}
{%- else -%}
{%- assign product_form_classes = 'product-item__action-list product-item__action-list--list-view-only button-stack' -%}
{%- endif -%}
{%- assign form_id = 'product_form_id_' | append: product.id | append: '_' | append: section.id -%}
{%- if product.template_suffix == 'contact' -%}
{%- comment -%}
The complementary product has an exception, where the form is shown outside
{%- endcomment -%}
{%- if complementary_products and show_add_to_cart -%}
{{- quick_buy_form -}}
{%- endif -%}