One issue you might be running into here is that i think when you remove an item from the array in the ForEach loop like you’re doing, it is going to resize the array, and the foreach loop is potentially skipping some of the items in your inventory. Ie if you remove whatever is in the array at index 1, then the array resizes and everything has its index moved down by 1. The item that was at entry 2 now goes to 1, whatever was at 3 goes to index 2, etc. But the loop is going to still move on to index 2 (so that item just got skipped).
One way you could get around this is by making a temporary item array, and when you find the matching item, instead of removing it from the player inventory right away, add it to the temporary array. Once you’re done looping through the player’s inventory, you would then loop through the temporary array, removing any entry in there from the player’s inventory (use the ‘remove item’ node instead of remove index and it will find and remove the correct item for you).
Hope that makes sense! I don’t have access to ue4 at the moment so I can’t show you what i mean visually.