Harley
01/08/2021, 7:13 AMvar cart = container.getComponent('Cart');
if (!cart) return;
cart.on('beforeShowContent', function(view)
{
if (view !== cart.CART_VIEW) return;
cart.getLines().then(function(lines)
{
_.each(lines, function(line)
{
var product = line && line.item || {},
item = product.extras || {};
if (!item.ispurchasable) return;
cart.removeChildView(
'Item.ListNavigable [data-item-id="' + product.internalid + '"]', // data-view or some form of element selector for the line I want to adjust
'StockDescription' // name of data-view to remove
);
});
});
});
Steve Goldberg
01/08/2021, 11:11 AMremoveChildView
works on the parent view class and not instances. By conditionally triggering it, you're essentially deciding whether to remove it from all instances of the view and not just some of them.Steve Goldberg
01/08/2021, 11:12 AMSteve Goldberg
01/08/2021, 11:16 AMcart.removeChildView
you would do something like:
jQuery('Item.ListNavigable [data-item-id="' + product.internalid + '"]').remove()
Harley
01/10/2021, 5:18 AMKearobi
01/12/2021, 3:45 PM