{% sw_extends '@Storefront/storefront/page/checkout/checkout-item.html.twig' %}
{% block page_checkout_item %}
{% if controllerAction != "finishPage" %}
{# @fourtwosix-edit: if usePluginQmUnit is true we use code copied from fourtwosixBuyByQmUnit otherwise from fourtwosixAddPurchaseUnit #}
{% set productUnitAkeneoKey = page.cart.data.elements["product-"~ lineItem.id].unit.translated.customFields["akeneo_key"] %}
{% set productPurchaseUnit = page.cart.data.elements["product-"~ lineItem.id].purchaseUnit %}
{# @fourtwosix-edit: Added productPurchaseUnit !== 1.0 to avoid showing it for every stuck with packboxstk = 1 #}
{% else %}
{% set productUnitAkeneoKey = lineItem.price.referencePrice.unitName %}
{% set productPurchaseUnit = lineItem.price.referencePrice.purchaseUnit %}
{% endif %}
{% set enableUnitConversion =
productUnitAkeneoKey !== "set" and
productUnitAkeneoKey !== "box" and
(productPurchaseUnit !== null and productPurchaseUnit !== 1.0) %}
{% if lineItem.type == "product" %}
{% if enableUnitConversion %}
{% sw_include "storefront/page/checkout/checkout-item-fourtwosixBuyByQmUnit.html.twig" %}
{% else %}
{% sw_include "storefront/page/checkout/checkout-item-storefront.html.twig" %}
{% endif %}
{% elseif lineItem.type == "payment_cost" %}
{# @fourtwosix-edit: if is a surcharge use the plugins template #}
{{ block("page_checkout_item", "@FourtwosixPaymentSurcharge/storefront/page/checkout/checkout-item.html.twig") }}
{% elseif lineItem.type == "promotion" %}
{% if lineItem.extensions.fourtwosixThemeExtension.deliveryDiscount %}
{% sw_include "@FourtwosixPaymentSurcharge/storefront/page/checkout/fts-checkout-item.html.twig" %}
{% elseif not lineItem.extensions.fourtwosixThemeExtension.isApplied %}
{{ block("page_checkout_item", "@Storefront/storefront/page/checkout/checkout-item.html.twig") }}
{% endif %}
{% else %}
{{ block("page_checkout_item", "@Storefront/storefront/page/checkout/checkout-item.html.twig") }}
{% endif %}
{% endblock %}