Using groups to toggle visibility of items in gridcontainer?

Godot Version

4.1.1

Question

I’m totally new to groups

If I fill gridcontainer with items like this is there a way to use groups to show only some of the items in the gridcontainer? For example if I had three types of weapons; axe, sword and pencil could I showhow toggle on/off them individually? So I see only axes, axes+swords and so forth?

Naturally it gets trickier as some items can be in many groups so the item needs to fulfill all the criteria to be visible.

Or maybe groups an option here? I don’t really know how use the groups after creating them in this way:

for item in dictionary_of_items:
    var new_instance1 = slot.instantiate()
    new_instance1.init(dictionary_of_items[item])
    get_node("GridContainer").add_child(new_instance1)
    new_instance1.add_to_group(dictionary_of_items[item]["weapon_type"])
    new_instance1.add_to_group(dictionary_of_items[item]["maker"])
    new_instance1.add_to_group(dictionary_of_items[item]["rarity"])