how to inherit outof stock message from parent item to child item

to to that first, we need to find out whether in Netsuite for parent item is message and that message is not added to child item in that we can extended the view which we want display and we can add code.

_.extend(ProductLineStockView.prototype, {
                    getContext: _.wrap(ProductLineStockView.prototype.getContext, function (fn) {
                        try {
                            var original = fn.apply(this, _.toArray(arguments).slice(1));
                            let outOfStockMessage = original.model.get("outofstockmessage") !== "" ? 
                            original.model.get("outofstockmessage") :  original.model.get("parentItem")?.outofstockmessage;
                            original.stockInfo.outOfStockMessage = outOfStockMessage !== "" ? outOfStockMessage : original.stockInfo.outOfStockMessage;
                            return original;
                        } catch (e) {
                            console.log('An error occurred while displaying Out-Of-Stock message.', e);
                        }
                    }),
                });

Leave a comment

Your email address will not be published. Required fields are marked *