Skip to content

fix: Mark discount on cart root node as used too#175

Merged
sveneberth merged 1 commit intoviur-framework:mainfrom
sveneberth:fix/discount_used_counter
Jan 16, 2026
Merged

fix: Mark discount on cart root node as used too#175
sveneberth merged 1 commit intoviur-framework:mainfrom
sveneberth:fix/discount_used_counter

Conversation

@sveneberth
Copy link
Copy Markdown
Member

@sveneberth sveneberth commented Jan 16, 2026

Overview

This pull request resolves an issue where discounts applied to the root node of a cart were not considered in the discount handling process. It ensures that all discounts, including those on the cart's root node, are correctly tracked and marked as used.

Key Changes

  1. Add Root Node to Discount Collection:

    • The get_discounts_from_cart method now explicitly adds the cart's root node to the list of nodes, ensuring discounts on the root node are correctly included:
      nodes.append(self.shop.cart.skel(skelType="node").read(cart_key))  # the root node itself
  2. Ensure Discount Usage is Updated:

    • The mark_discount_used method is updated to handle order_skel instances properly. It tracks and increases quantity_used for discounts associated with an ordered cart.

Impact

These changes ensure that all discounts, including those applied at the root level, are tracked and managed accurately. This fixes inconsistencies in discount processing and improves overall reliability of the cart system.

@sveneberth sveneberth added Priority: High After critical issues are fixed, these should be dealt with before any further issues. bug(fix) Something isn't working or address a specific issue or vulnerability component: module labels Jan 16, 2026
@sveneberth sveneberth changed the title fix: Mark disocunt on cart root node as used too fix: Mark discount on cart root node as used too Jan 16, 2026
@sveneberth sveneberth merged commit c646f06 into viur-framework:main Jan 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug(fix) Something isn't working or address a specific issue or vulnerability component: module Priority: High After critical issues are fixed, these should be dealt with before any further issues.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant