Skip to content

Conversation

@aelzakzouk
Copy link
Contributor

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

What is the current behaviour? (You can also link to an open issue here)

What is the new behaviour? (You can also link to the ticket here)

Does this PR introduce a breaking change?

Screenshots (If appropriate)

@sallainternalbot sallainternalbot bot marked this pull request as draft January 19, 2026 14:06
@aelzakzouk aelzakzouk marked this pull request as ready for review January 19, 2026 14:06
</div>

<div class="border-t border-b border-gray-200 py-3 md:p-0 md:border-none mt-5 md:mt-0 flex gap-8 justify-between items-center md:items-start">
{% set is_free_cart_offer = item.offer is defined and item.offer and (item.offer.is_free|default(false)) and (item.offer.offer_type|default('') == 'cart_offer') %}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The code checks for item.offer.offer_type, but this field does not exist in the data model. The default('') filter causes the condition to always be false.
Severity: CRITICAL

Suggested Fix

The backend API needs to be updated to include the offer_type field in the item.offer object for cart items. Alternatively, if this field is not intended to be added, the new logic depending on it should be removed to avoid the silent failure. The PR should be updated to include any related backend changes.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: src/views/pages/cart.twig#L119

Potential issue: The code introduces a check `(item.offer.offer_type|default('') ==
'cart_offer')` to identify specific promotional items. However, the `offer_type` field
is not part of the documented data structure for the `item.offer` object and appears
nowhere else in the codebase. Because the field is missing, the `default('')` filter is
applied, causing the comparison to always evaluate to `false`. As a result, the
`is_free_cart_offer` variable is never true, which prevents the intended logic of
locking the quantity and hiding the delete button for these promotional items from ever
executing. This allows users to modify or remove items that should be fixed.

Did we get this right? 👍 / 👎 to inform future reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant