{% set sellopsUpsell = sellopsDirectData ?? page.extensions.sellopsPostPurchaseUpsell ?? null %} {% set upsellProducts = sellopsUpsell ? (sellopsUpsell.products ?? []) : [] %} {% set sliderItemsPerView = sellopsUpsell ? (sellopsUpsell.sliderItemsPerView ?? 2) : 2 %} {% set countdownSeconds = sellopsUpsell ? (sellopsUpsell.countdownSeconds ?? 0) : 0 %} {% set discountPercent = sellopsUpsell ? (sellopsUpsell.discountPercent ?? 0) : 0 %} {% set productDiscounts = sellopsUpsell ? (sellopsUpsell.productDiscounts ?? {}) : {} %} {% set headline = sellopsUpsell ? (sellopsUpsell.headline ?? '') : '' %} {% set subline = sellopsUpsell ? (sellopsUpsell.subline ?? '') : '' %} {% set orderId = sellopsUpsell ? (sellopsUpsell.orderId ?? '') : '' %} {% set acceptLabel = sellopsUpsell ? (sellopsUpsell.acceptLabel ?? '') : '' %} {% set declineLabel = sellopsUpsell ? (sellopsUpsell.declineLabel ?? '') : '' %} {% set offerExpired = sellopsUpsell ? (sellopsUpsell.offerExpired ?? false) : false %} {% set expiresAt = sellopsUpsell ? (sellopsUpsell.expiresAt ?? null) : null %} {% set hasTimedDiscount = orderId and expiresAt and not offerExpired %} {% set configurableProductIds = sellopsUpsell ? (sellopsUpsell.configurableProductIds ?? []) : [] %} {% set variantsByProductId = sellopsUpsell ? (sellopsUpsell.variantsByProductId ?? {}) : {} %} {% set hasOneClick = sellopsUpsell ? (sellopsUpsell.hasOneClick ?? false) : false %} {% set acceptUrl = sellopsUpsell ? (sellopsUpsell.acceptUrl ?? '') : '' %} {% set displayMode = sellopsUpsell ? (sellopsUpsell.displayMode ?? 'popup') : 'popup' %} {% set isPopup = displayMode != 'inline' %} {% if upsellProducts is not empty and not offerExpired %}
{% macro imageSlider(product, cssClasses) %} {% set productImages = [] %} {% if product.media is not empty %} {% for mediaItem in product.media %} {% if mediaItem.media is not null and mediaItem.media.url is not empty %} {% set productImages = productImages|merge([{ url: mediaItem.media.url, pos: mediaItem.position|default(0) }]) %} {% endif %} {% endfor %} {% endif %} {% if productImages is empty and product.cover is not null and product.cover.media is not null %} {% set productImages = [{ url: product.cover.media.url, pos: 0 }] %} {% endif %} {% if productImages is not empty %}
{% for img in productImages %} {% endfor %} {% if productImages|length > 1 %}
{% for i in 1..productImages|length %} {% endfor %}
{% endif %}
{% endif %} {% endmacro %} {% macro oneClickButton(product, orderId, offerExpired, acceptLabel, acceptUrl, discountPercent, expiresAt) %} {% set unitPrice = product.calculatedPrice is not null ? product.calculatedPrice.unitPrice : 0 %} {% set discountedPriceVal = discountPercent > 0 ? (unitPrice * (1 - discountPercent / 100))|round(2) : unitPrice %} {% set discountAmountVal = discountPercent > 0 ? (unitPrice - discountedPriceVal)|round(2) : 0 %} {% set coverImgUrl = product.cover is not null and product.cover.media is not null ? product.cover.media.url : '' %}
Added to your order!
Ships with your current order
{% endmacro %} {% macro simpleForm(product, hasTimedDiscount, expiresAt, orderId, offerExpired, acceptLabel, discountPercent, requiresCheckoutRedirect) %}
{% if discountPercent > 0 %} {% set effExpiresAt = sellops_upsell_discount_expiry(hasTimedDiscount ? expiresAt : 0) %} {% endif %} {% if hasTimedDiscount %} {% endif %}
{% endmacro %} {% macro variantSwatchOneClick(product, variants, orderId, offerExpired, acceptLabel, acceptUrl, discountPercent, expiresAt) %} {% set unitPrice = product.calculatedPrice is not null ? product.calculatedPrice.unitPrice : 0 %} {% set discountedPriceVal = discountPercent > 0 ? (unitPrice * (1 - discountPercent / 100))|round(2) : unitPrice %} {% set discountAmountVal = discountPercent > 0 ? (unitPrice - discountedPriceVal)|round(2) : 0 %} {% set coverImgUrl = product.cover is not null and product.cover.media is not null ? product.cover.media.url : '' %} {% set variantsSimple = [] %} {% for v in variants %} {% set variantsSimple = variantsSimple|merge([{id: v.id, label: v.label, groups: v.groups ?? []}]) %} {% endfor %}
👆 Please select all options to continue.
Added to your order!
Ships with your current order
{% endmacro %} {% macro variantForm(product, variants, hasTimedDiscount, expiresAt, orderId, offerExpired, acceptLabel, discountPercent) %} {% if variants is not empty %} {% set effExpiresAt = sellops_upsell_discount_expiry(hasTimedDiscount ? expiresAt : 0) %} {% set _variantSigs = {} %} {% if discountPercent > 0 %} {% for variant in variants %} {% set _variantSigs = _variantSigs|merge({ (variant.id): sellops_upsell_discount_signature(variant.id, discountPercent, effExpiresAt, hasTimedDiscount) }) %} {% endfor %} {% endif %}
{% else %} {{ (acceptLabel ?: 'Select options')|sw_sanitize }} {% endif %} {% endmacro %} {% set sellopsSliderOptions = { slider: { startIndex: 1, slideBy: 1, controls: upsellProducts|length > 1, nav: false, mouseDrag: upsellProducts|length > 1, autoplay: false, autoplayButtonOutput: false, speed: 300, ariaLive: true, gutter: 30, loop: false, rewind: true, items: sliderItemsPerView, responsive: { xs: { items: 1 }, sm: { items: sliderItemsPerView }, md: { items: sliderItemsPerView }, lg: { items: sliderItemsPerView }, xl: { items: sliderItemsPerView } } } } %}
{% for product in upsellProducts %}
{{ _self.imageSlider(product, 'col-12 col-md-6') }}
{% if orderId and expiresAt %} {% set initialMinutes = (countdownSeconds / 60)|round(0, 'floor') %} {% set initialSeconds = (countdownSeconds % 60) %}
{{ initialMinutes }}:{{ '%02d'|format(initialSeconds) }}
⏰ This special offer has expired. You can still add the product at the regular price.
{% endif %}

{{ (headline ?: 'You may also like')|sw_sanitize }}

{% if subline %}
{{ subline|sw_sanitize }}
{% endif %}
{{ product.translated.name|default('')|sw_sanitize }}
{% set pidKey = (product.id|default(''))|lower|replace({'-': ''}) %} {% set effectivePct = (productDiscounts[pidKey] is defined and productDiscounts[pidKey] is not null) ? productDiscounts[pidKey] : discountPercent %} {% if product.calculatedPrice is not null %} {% set originalPrice = product.calculatedPrice.unitPrice %} {% set discountedPrice = effectivePct > 0 ? (originalPrice * (1 - effectivePct / 100)) : originalPrice %}
{% if effectivePct > 0 and discountedPrice < originalPrice %}
{{ discountedPrice|currency }}
{{ originalPrice|currency }}
{{ originalPrice|currency }}
Save {{ effectivePct|round(0) }}% off
{% else %}
{{ originalPrice|currency }}
{% endif %}
{% endif %} {% set shortDescription = product.translated.description|default('')|striptags %} {% if shortDescription %}
{{ shortDescription|length > 140 ? (shortDescription|slice(0, 140) ~ '...') : shortDescription }}
{% endif %}
{% endfor %}
{% if upsellProducts|length > 1 %}
{% endif %}
{% if isPopup %} {% endif %} {% endif %}