Search code examples
intershop

ProductLineItem FreeGift changes where we don't expect it to


We are having some strange problems with free gifts.

After calling ProcessBasket-RemoveLineItem, flag FreeGift in ProductLineItem that remain in the basket is changed from true to false.

It looks like the problem is in InvalidateBasketCalculation pipelet (from bc_basket), called in ProcessBasketInvalidation-SetBasketInvalidationStatus.

enter image description here


Solution

  • The information whether a product is a free gift is stored in the ComputedItems of the basket calculation results. By calling the pipeline ProcessBasket-RemoveLineItem, the basket calculation results are marked as invalid (as you correctly found out this is done by the pipelet InvalidateBasketCalculation). As a result, existing ComputedItems will be removed, as they may no longer be correct (note that this is a recent change that has been introduced with ICM 7.10.5.5; if you're using an older version there may be other causes for this problem). So the information whether a product is a free gift gets lost at this point of time.

    To fix this, simply trigger the basket calculation again by calling pipeline ProcessBasket-Calculate.