Skip to content

Release 1.165.3 - #3940

Merged
odlbot merged 4 commits into
releasefrom
release-candidate
Sep 9, 2026
Merged

odlbot merged 4 commits into
releasefrom
release-candidate

Conversation

@odlbot

@odlbot odlbot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Chris Patti

cp-at-mit

cp-at-mit and others added 4 commits September 8, 2026 15:00
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

OpenAPI Changes

Show/hide changes
## Changes for v0.yaml:
No changes detected

## Changes for v1.yaml:
No changes detected

## Changes for v2.yaml:
No changes detected

Unexpected changes? Ensure your branch is up-to-date with main (consider rebasing).

status=status.HTTP_400_BAD_REQUEST,
)
basket.basket_items.all().delete()
BasketDiscount.objects.filter(redeemed_basket=basket).delete()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: The create_basket_with_products function deletes all basket discounts when ENABLE_MULTIPLE_CART_ITEMS=False but fails to re-apply existing manual discounts, causing them to be silently lost.
Severity: HIGH

Suggested Fix

Mirror the logic in the _create_basket_from_product function. Before deleting discounts, read and store any existing manually-applied discounts from the basket. After clearing the basket and adding the new product, re-apply these stored manual discounts along with any auto-apply discounts. This will ensure discount preservation consistency across different cart update flows.

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: ecommerce/views/v0/__init__.py#L435

Potential issue: When `ENABLE_MULTIPLE_CART_ITEMS` is `False`, the
`create_basket_with_products` view deletes all existing discounts from a basket but does
not re-apply any manually-added discounts. The code at
`ecommerce/views/v0/__init__.py:435` calls
`BasketDiscount.objects.filter(redeemed_basket=basket).delete()`, clearing all
discounts. Unlike the similar `_create_basket_from_product` function, it lacks logic to
preserve and re-apply these discounts. This causes a user who updates their cart with a
single product to silently lose any previously applied manual discounts, resulting in an
unexpected price increase at checkout.

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

@odlbot
odlbot merged commit 90e2a77 into release Sep 9, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants