[16.0][IMP] pos_loyalty_exclude: Implementing logic to prevent the discount from being applied to excluded products.#1486
Open
SuShanVoong wants to merge 1 commit intoOCA:16.0from
Conversation
Author
bb7765f to
2d355bd
Compare
|
LGTM |
LuisAlejandroS
approved these changes
Feb 17, 2026
a913437 to
5fea753
Compare
…scount from being applied to excluded products.
5fea753 to
0e533ee
Compare
Author
|
Can someone review the PR? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Description
An issue was identified in the loyalty discount logic where products marked with the option “Exclude product from discount programs” were still receiving discounts when added to the cart.
When a product configured as excluded was added to the cart, any active loyalty discount program was still applied to that product, regardless of its exclusion setting.
Root Cause
The exclusion logic in the loyalty module was originally designed to manage point accumulation and free product rewards. However, it did not fully cover all types of loyalty discounts—specifically, discount-based rewards. As a result, products marked as excluded were still considered eligible for certain discount calculations.
This issue affected all discount configurations, including:
Cases Covered with This Improvement
This update ensures that excluded products are properly ignored across all loyalty discount scenarios:
Case 1: Automatic Discounts
When an excluded product is added to the cart and an automatic loyalty discount program is active:
The discount is no longer applied to the excluded product.
The reward button is not highlighted if only excluded products are present in the cart.
Case 2: Discount Code Application
When an excluded product is added to the cart and a discount is applied via promo code:
The discount is not applied to the excluded product.
The loyalty exclusion logic is properly enforced.
Additionally, the fix ensures correct behavior across all discount calculation types:
Implemented Solution
The solution introduces proper handling of the loyalty_exclude parameter at the POS JavaScript level.
The following logic adjustments were implemented:
_getDiscountableOnOrder: Excluded products are no longer included in the reward amount calculation._getCheapestLine: Excluded products are ignored when determining the cheapest product in the order.getClaimableRewards: If the cart contains only excluded products, the Rewards button is no longer highlighted._get_regular_order_lines: apply the filter so that it does not add the excluded products.These changes ensure that loyalty exclusions are consistently enforced across all discount types and reward calculations.
FL-571-7802