{% sw_extends '@Storefront/storefront/page/checkout/checkout-item.html.twig' %}
{% block page_checkout_item_container %}
{% set productUnitAkeneoKey = page.cart.data.elements["product-"~ lineItem.id].unit.translated.customFields["akeneo_key"] %}
{% set productPurchaseUnit = page.cart.data.elements["product-"~ lineItem.id].purchaseUnit %}
{% set enableUnitConversion = productUnitAkeneoKey !== "set" and productUnitAkeneoKey !== "box" and productPurchaseUnit !== 1.0 %}
{% block page_checkout_item_quantity_number %}
{% if controllerAction == "finishPage" %}
{% if enableUnitConversion %}
<div class="d-flex justify-content-end cart-item-quantity">
{{ lineItem.price.referencePrice.purchaseUnit * lineItem.quantity }}
</div>
{% else %}
{{ parent() }}
{% endif %}
{% endif %}
{% endblock %}
{% if true and page.cart.data.elements["product-"~ lineItem.id].unit.translated.name == null %}
{{ parent() }}
{% else %}
<div class="cart-item cart-item-{{ lineItem.type }}{% if isDiscount %} is-discount{% endif %}{{ cartItemClasses }} fourtwosix-qm-unit" data-buybyqmunit-plugin="true">
<div class="row cart-item-row">
{% block page_checkout_item_info %}
{{ parent() }}
{% endblock %}
{% block page_checkout_item_quantity_qm %}
<div class="col-12 col-sm-4 col-md-4 cart-item-quantity">
{% if lineItem.quantityInformation and lineItem.stackable and not isChild %}
<form action="{{ path('frontend.checkout.line-item.change-quantity', {'id': lineItem.id}) }}" class="cart-item-quantity-container cartForm" method="post" data-form-auto-submit="true">
{{ sw_csrf('frontend.checkout.line-item.change-quantity') }}
{% if activeRoute == "frontend.checkout.cart.page" %}
<input type="hidden" name="redirectTo" value="frontend.checkout.cart.page">
{% elseif activeRoute == "frontend.checkout.confirm.page" %}
<input type="hidden" name="redirectTo" value="frontend.checkout.confirm.page">
{% endif %}
{% set quantityUnit = page.cart.data.elements["product-"~ lineItem.id].purchaseUnit %}
{% set quantityPack = page.cart.data.elements["product-"~ lineItem.id].referenceUnit %}
{% set minPurchase = page.cart.data.elements["product-"~ lineItem.id].minPurchase %}
{% set purchaseSteps = page.cart.data.elements["product-"~ lineItem.id].purchaseSteps %}
{% set availableStock = lineItem.payload.isCloseout ? lineItem.quantityInformation.maxPurchase : config('core.cart.maxQuantity') %}
{% sw_include '@Storefront/storefront/component/product/card/price-qm-unit.html.twig' with {
'isCloseout': lineItem.payload.isCloseout,
'stock': availableStock,
'priceUnit': lineItem.price.unitPrice,
'sellingUnit': quantityUnit * lineItem.quantity,
'packUnit': lineItem.quantity,
'quantityInputName': "quantity",
'quantityInputClasses': 'quantity-select',
'translatedUnitName' : lineItem.price.referencePrice.unitName,
'minPurchase': minPurchase,
'purchaseSteps': purchaseSteps
} %}
</form>
{% endif %}
</div>
{% endblock %}
{% block page_checkout_item_total_price_qm %}
<div class="col-12 col-sm-4 col-md-2 cart-item-total-price">
<div class="d-flex flex-column align-items-end h-fit">
{% block page_checkout_item_unit_price_wrapper %}
{% if not isDiscount %}
{% block page_checkout_item_unit_price_label %}
<div class="cart-item-unit-price-label">
{{ "checkout.cartHeaderUnitPrice"|trans|sw_sanitize }}
</div>
{% endblock %}
{% block page_checkout_item_unit_price_inner %}
{{ lineItem.price.unitPrice|currency }}
{% block page_checkout_item_unit_price_tax_symbol %}
{{ "general.star"|trans|sw_sanitize }}
{% endblock %}
{% endblock %}
{% endif %}
{% endblock %}
</div>
<div class="mt-md-2 text-right">
{% block page_checkout_item_total_price_wrapper %}
{% block page_checkout_item_total_price_label %}
<div class="cart-item-total-price-label fts-qm">
{{ "checkout.cartHeaderTotalPrice"|trans|sw_sanitize }}
</div>
{% endblock %}
{% block page_checkout_item_total_price_inner %}
{# Shipping costs discounts always have a price of 0, which might be confusing, therefore we do not show those #}
{% if lineItem.payload.discountScope != 'delivery' %}
<b class="totalPrice">{{ lineItem.price.totalPrice|currency }}</b>
{% block page_checkout_item_total_price_tax_symbol %}
{{ "general.star"|trans|sw_sanitize }}
{% endblock %}
{% endif %}
{% endblock %}
{% endblock %}
</div>
</div>
{% endblock %}
{% block page_checkout_item_remove %}
{{ parent() }}
{% endblock %}
{% block page_checkout_item_children_template %}
{{ parent() }}
{% endblock %}
</div>
</div>
{% endif %}
{% endblock %}