{% doc %} Renders one product card for the best sellers slider. Sold-out products are skipped so the card can always be added or bought. @param {product} product - Product to display @param {string} [form_suffix] - Suffix that keeps the add-to-cart form id unique @example {% render 'bestsellers-card', product: product, form_suffix: section.id %} {% enddoc %} {% if product.available %} {% liquid assign variant = product.selected_or_first_available_variant assign card_image = product.featured_image assign hover_image = blank for image in product.images offset: 1 limit: 1 assign hover_image = image endfor assign image_alt = card_image.alt | default: product.title assign subtitle = product.metafields.custom.subtitulo.value | default: product.metafields.custom.subtitulo if subtitle == blank assign subtitle = product.metafields.custom.subtitle.value | default: product.metafields.custom.subtitle endif if subtitle == blank assign subtitle = product.metafields.custom.presentacion.value | default: product.metafields.custom.presentacion endif if subtitle == blank and variant.title != 'Default Title' assign subtitle = variant.title endif %} {% capture collection_label %} {% render 'product-collection-label', product: product %} {% endcapture %} {% liquid assign collection_label = collection_label | strip assign rating_value = 0 assign rating_count = 0 if product.metafields.reviews.rating.value != blank assign rating_value = product.metafields.reviews.rating.value.rating | round endif if product.metafields.reviews.rating_count.value != blank assign rating_count = product.metafields.reviews.rating_count.value endif assign compare_price = variant.compare_at_price assign show_compare = false if compare_price > variant.price assign show_compare = true endif %}
{% if card_image %} {{ card_image | image_url: width: 800 | image_tag: alt: image_alt, widths: '245, 386, 490, 772', sizes: '(max-width: 1024px) 245px, 386px', class: 'bestsellers__image', loading: 'lazy' }} {% if hover_image != blank %} {{ hover_image | image_url: width: 800 | image_tag: alt: '', widths: '245, 386, 490, 772', sizes: '(max-width: 1024px) 245px, 386px', class: 'bestsellers__image bestsellers__image--hover', loading: 'lazy' }} {% endif %} {% else %} {% endif %}
{{ 'bestsellers.badge' | t }} {% if collection_label != blank %} {{ collection_label | escape }} {% endif %}
{{ product.title | escape }} {% if subtitle != blank %}

{{ subtitle | escape }}

{% endif %} {% if rating_count > 0 %}

{{ 'bestsellers.reviews' | t: count: rating_count }}

{% endif %}
{{ variant.price | money_without_trailing_zeros }} {% if show_compare %} {{ compare_price | money_without_trailing_zeros }} {% endif %}
{% endif %}