RE: How to get the items related to a promotion in a scriptablecart?
Hello everyone, first question and a little challenging!
I am working with one ScriptableCart, depending on the price of the item, I request to an external service to obtain the taxes and apply them to the lineItem.
Everything was fine, until the promotions appeared.
They aren’t stored on the lineItem, they only appear as a separate line on the order that only has some data, such as the promotionId and its discount, but not to which product it is being applied.
In frontend, SCA processes it well with the LiveOrder.Model, but in the ScriptableCart I don’t have the discount applied to the lineItem, so I don’t have the real amount.
One possibility, which I want to avoid because of loading times each time the cart is modified, would be to search all promotions to this order and obtain the product ID to which it is applied and then apply the discount manually to the lineTotal.
Do you know any other more effective way? I would like to be able to get the nlapiGetContext data in the ScriptableCart, but it doesn’t work. Any suggestions?
Thank you very much