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

Rookie Asked on October 10, 2019 in SuiteCommerce.
Add Comment
2 Answer(s)

Promotions/Discounts in NS are applied either on body level(using DISCOUNT ITEM field) or on the line item level, but I don’t think there’s a way to identify to which product they are applied to as they are applied to the whole order in NS. If there’s only one item on the transaction then it’s simple to know that the discount is applied only to that item amount but with multiple items you can’t know.  Does that answer your question?

Beginner Answered on October 10, 2019.

Ritika, there are some promotions applied for specific items. On the frontend I see a discount field on the item which has the discount applied. I really need that but on the scriptablecart, or knowing the productId which the promotion applies.

on October 10, 2019.

Hi Kevin, I haven’t worked on this part but found something useful in the NS help guide.  If you have access to the NetSuite account, just go to the help guide and search for “Sample Scripts for Scriptable Cart” and then look under the Dynamic Discounts section. If you don’t have access then I can send you code snippet here. Let me know.

on October 10, 2019.

Yes, I saw it before and its for custom promotions, not netsuite ones, also it is doing a search which im trying to avoid. But thanks anyways

on October 11, 2019.
Add Comment

thru AJAX that invokes suitelet

Beginner Answered on October 10, 2019.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor