After the recent changes to the buy-widget structure, the reference price is no longer displayed correctly.
The current implementation wraps the reference price output in an if condition that only evaluates to true when the calculatedPrices array is empty. As a result, the reference price is not shown whenever calculatedPrices contains entries.
This becomes a critical issue when using the JTL connector, as it typically populates the calculatedPrices array. Consequently, reference prices are never displayed in these cases.
Expected behavior:
The reference price should be displayed independently of whether calculatedPrices contains values.
Actual behavior:
The reference price is only displayed when calculatedPrices is empty.
{% if product.calculatedPrices|length == 0 %}
{% set price = product.calculatedPrice %}
{% if price.referencePrice is not null %}
{% block buy_widget_price_unit_reference_content %}
<span class="price-unit-reference-content">
({{ price.referencePrice.price|currency }} / {{ price.referencePrice.referenceUnit }} {{ price.referencePrice.unitName }})
</span>
{% endblock %}
{% endif %}
{% endif %}
Possible solution might be the one used in buy-widget-price.html.twig
{% set price = product.calculatedPrice %}
{% if product.calculatedPrices|length == 1 %}
{% set price = product.calculatedPrices.first %}
{% endif %}
Affected code:
|
{% if product.calculatedPrices|length == 0 %} |
After the recent changes to the buy-widget structure, the reference price is no longer displayed correctly.
The current implementation wraps the reference price output in an if condition that only evaluates to true when the calculatedPrices array is empty. As a result, the reference price is not shown whenever calculatedPrices contains entries.
This becomes a critical issue when using the JTL connector, as it typically populates the calculatedPrices array. Consequently, reference prices are never displayed in these cases.
Expected behavior:
The reference price should be displayed independently of whether calculatedPrices contains values.
Actual behavior:
The reference price is only displayed when calculatedPrices is empty.
Possible solution might be the one used in buy-widget-price.html.twig
Affected code:
shopware/src/Storefront/Resources/views/storefront/component/buy-widget/buy-widget.html.twig
Line 164 in e558f87