How do i turn on and of the collider component of various gameobjects at once

so in a my game i want that when my character picks up a coin he can walk through some walls.
i have tried using some codes but they dont work pls how can i achieve this?
here is my current code

GameObject.FindGameObjectsWithTag("wall").collider.isTrigger=true;

FindGameObjectsWithTag() returns an array of Game Objects, so if you want to change all of their colliders, you would need to do something like this:

GameObject[] gameObjects = GameObject.FindGameObjectsWithTag("wall");

foreach (GameObject go in gameObjects) {
	go.collider.isTrigger = true;	
}