Hide tab from my account section

Need to hide any tabs from my account menu using the extension

To achieve this we need to extend the MenuTreeView, so we can get all the child tabs and need to compare each child with some unique ids. if it matches with our required tab, hide the same.

_.extend(MenuTreeView.prototype, {
  getContext: _.wrap(MenuTreeView.prototype.getContext, function (fn) {
  var original_Ret = fn.apply(this, _.toArray(arguments).slice(1));
						
	_.each(original_Ret.menuItems, function (line) {					
	 _.each(line.children, function (children) {							
	   if (children.id == "returns") {														
		var menuitems = line.children;
		var arr = [];								
		var hidden = _.reject(menuitems, function(num) {
		return num.id == "returns" 
		})
		menuitems = hidden
		arr.push(menuitems);							
		line.children = arr[0];							
			}
			    })
				})

			return original_Ret;
				})
			});

Here we compare children.id whether returns or not, whenever it matches with the “return” then that will be hidden.

Leave a comment

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