Skip to content

[Bug]: Coupon discount calculation ignores apply_on and always uses subtotal #201

@my-dev-jour

Description

@my-dev-jour

Bug Description

POS coupons support different calculation bases such as Grand Total and Net Total, but the frontend coupon flow computes the discount from subtotal-before-tax and sends that as the final discount amount.

As a result, the effective discount can differ from the coupon's configured apply_on behavior.

Expected Behavior

Coupon discount amount should be calculated from the correct base according to the configured apply_on value.

Actual Behavior

The frontend always derives the coupon discount from subtotal instead of honoring apply_on.

Steps to Reproduce

  1. Create coupons with different apply_on values, for example Grand Total and Net Total
  2. Build a cart where tax and totals differ enough to expose the calculation base
  3. Apply the coupon in POSNext
  4. Compare the applied discount against the configured coupon basis

Impact

  • wrong discount totals
  • mismatch between coupon configuration and frontend behavior
  • inconsistent pricing and tax outcomes

Suggested Fix

  • compute discount amount from the correct pricing basis for the configured apply_on
  • keep frontend and backend coupon math aligned for the final applied discount

Notes

This is a pricing-calculation bug in the POSNext frontend coupon flow, not just a display issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions