Edit SumRndmDde's Switch Shop

Pluggin: http://sumrndm.site/switch-shop/

How can I edit the code to allow the party to gain the bought item? I'm looking at the code from line 296. I added the fourth line:

Code:
    Scene_SwitchShop.prototype.doBuy = function(number) {
       $gameParty.loseGold(this._item[2]);
       $gameSwitches.setValue(this._item[1], true);
        $gameParty.gainItem(this._item[]);
    };
However, I'm not certain how to do this right - I don't understand why the numbers [2] and [1] are not the same.

Edit: So from line 184 there's this. So not certain, but I'd be experimenting on which number to use next I guess.

Code:
    Scene_SwitchShop.prototype.prepare = function(goods) {
        this._goods = [];
        for(var i = 0; i < goods.length; i++) {
            var good = $dataItems[goods[i][1]]
            this._goods[i] = [];
            this._goods[i][0] = good.name;
            this._goods[i][1] = good.meta.switchShopSwitch;
            this._goods[i][2] = goods[i][2] === 0 ? good.price : goods[i][3];
            this._goods[i][3] = good.meta.switchShopDescription;
            this._goods[i][4] = good.iconIndex;
        }
        this._item = null;
    };

Reason for why I want to edit this:

So I've noticed that the "item" bought isn't added to your inventory. Only the switch is turned on. Is it possible to allow the item to also be added as an option?

I'd like to set items bought via the switch shop as hidden items, so that they're still invisible to the player, but I can do further manipulation behind the scenes. I wanted to use possession of hidden items as a conditional check to "restock" the item in the shop by turning off the switch.
Update:


Code:
    Scene_SwitchShop.prototype.doBuy = function(number) {
        $gameParty.loseGold(this._item[2]);
        $gameParty.gainItem($dataItems[8],1);
        $gameSwitches.setValue(this._item[1], true);
    };

$gameParty.gainItem($dataItems[8],1); works as expected, but I'm not sure how to get it to focus on the desired item than hard coding it.


Code:
    Scene_SwitchShop.prototype.doBuy = function(number) {
        $gameParty.loseGold(this._item[2]);
        $gameParty.gainItem(this._item[]);
        $gameSwitches.setValue(this._item[1], true);  
    };

$gameParty.gainItem(this._item[]); causes me to get the desired item, but the switch fails to turn on. This single line disables the pluggin from what I understand (the shop window now shows possession count of highlighted item - it didn't show this before)
Bump.

I've contacted Some Random Dude to no avail. Also wondering if it's possible to change this such that buying weapons/armor can activate switches as well. Looking through, but not confident in what I'd have to change in the script to allow that.

Original thread: https://forums.rpgmakerweb.com/threads/edit-sumrndmddes-switch-shop.74743/