{% doc %} Offer card (F19): image or a 2x2 grid of product pictures, badge, name, deal, and for fixed bundles the bundle price, the struck-through regular price and the number of items; end date; link to the bundle page. Fixed-bundle prices come from live product prices (all_products, presentment currency); bundle-offers.js recomputes $-off / bundle-price deals when the customer shops in another currency. @param {object} offer - An offer from the app's storefront data @param {string} [heading_tag] - h2 or h3 (default h3) @example {% render 'bo-card', offer: offer %} {% enddoc %} {%- liquid assign url = '/apps/bundles/' | append: offer.h assign tag = heading_tag | default: 'h3' assign locale = request.locale.iso_code assign name = offer.n assign badge = offer.b if offer.i[locale].n != blank assign name = offer.i[locale].n endif if offer.i[locale].b != blank assign badge = offer.i[locale].b endif assign regular = 0 if offer.t == 'fixed' for line in offer.l assign p = all_products[line.h] if p.id assign price = p.price if line.v != '' for variant in p.variants assign vid = variant.id | append: '' if vid == line.v assign price = variant.price endif endfor endif assign line_total = price | times: line.q assign regular = regular | plus: line_total endif endfor assign dv_cents = offer.dv | times: 100 case offer.dt when 'percent' assign saving = regular | times: offer.dv | divided_by: 100.0 | round when 'amount' assign saving = dv_cents | at_most: regular else assign saving = regular | minus: dv_cents | at_least: 0 endcase assign bundle = regular | minus: saving endif -%}
{%- if badge != blank -%}

{{ badge }}

{%- endif -%}
<{{ tag }} class="bo-card__title">{{ name }}

{% render 'bo-summary', offer: offer %}

{%- if offer.t == 'fixed' and regular > 0 -%}

{{ 'bundle_offers.card.bundle_price' | t }} {{ bundle | money }} {%- if saving > 0 -%} {{ 'bundle_offers.card.regular_price' | t }} {{ regular | money }} {%- endif -%} {{ 'bundle_offers.card.items' | t: count: offer.ni }}

{%- endif -%} {%- if offer.e != blank -%} {%- assign ends = offer.e | time_tag: format: 'date' -%}

{{ 'bundle_offers.card.ends_html' | t: date: ends }}

{%- endif -%} {{ 'bundle_offers.card.shop' | t }}