Extension to make outofstock message in plp

_.extend(ProductLineStockView.prototype, {
     getContext: _.wrap(ProductLineStockView.prototype.getContext, function (fn) {
         var originalRet=fn.apply(this, _.toArray(arguments).slice(1));
         var showmessage=this.model.attributes._isInStock;

         if(showmessage) {
           console.log("inside if")
         }

         else {
           originalRet.showOutOfStockMessage=true;
         }

         return originalRet;
       })
   });

Leave a comment

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