How to cascade variables from a catalog item to shopping cart widget?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 02:05 AM
Hi Team ,
I presently have a requirement that the shopping cart widget should display few variable fields of a catalog item.
For example the shopping cart widget has only Item and quantity field available as an OOB feature but the cx requires other variables that is available in a catalog item like Requested for ,Ip address and etc to be displayed in the shopping widget.
I have checked few community post and was able to figure out that there is one script include called "SPCart" in which a few lines of scripts are required to get the variable data .
But i am not sure what changes needs to done in the "large_shopping_cart_v2.html " ng-template to accomplish the requirement.
I will post the script that was written in the script include below and kindly let me know what changes are required in the ng-template to achieve this requirement.
For any clarification needed ,kindly revert .
script includes :
var scItemOptionGR = new GlideRecord("sc_item_option");
scItemOptionGR.addQuery("cart_item",cartItemID);
scItemOptionGR.query();
var variables = {};
while(scItemOptionGR.next())
{
var v = scItemOptionGR.getDisplayValue('value');
variables[scItemOptionGR.item_option_new.name] = (v == null || v =='' ? '' : v);
}
var cartItem = GlideappCartItem.get(cartItemID);
return {
variables:variables.requested_for,
}
Thanks