Make a few phone calls. Both the garden centers and the pet stores sell something to keep cats out of an area. You spray it around the perimeter. Have to respray after each rain. Or do an internet search.

Or do what we do. Plant some catnip in your garden; but watch it because it spreads like weeds VERY fast.

The point is, cats do not like their bathroom near their kitchen. If they are eating in the garden area, they won't be using it as a bathroom.

We have a large garden area in our backyard. Vegetables and herbs in one area (22 y 46 feet) and another with flowers. We have catnip in both areas. It wasn't planned that way; but it spreads.

We often see neighboorhood cats wandering through, partaking of ths delightful treat. AND we see them mark their territory - about 8 to 10 feet AWAY from the garden! I never really thought about it until you made this thread. All I can come up with as to why the cats don't use our garden as their bathroom is that it is their kitchen.