Thanks to economies of scale, driving to your local farm to pick up groceries is VASTLY worse for the environment than trucking it to a supermarket and picking up everything there.
The final leg of the trip is by far the worst in terms of resource depletion. Shipping goods across half the world is hyper-efficient, in a slow ship that's mostly cargo and floating on water. But driving to the store of market means you're moving 2 tons of metal at 90mph, stopping and starting it repeatedly to pick up 400 grams of tomatoes.
The farmer's market is by far the worst here, since is usually involves a small truck moving the product to multiple locations for a single sale, and then transporting it by private vehicles again. Even growing it at home is mediocre at best, assuming you need to drive to pick up seeds, soil and fertilizer. And growing food at home doesn't reduce your grocery-store trips, you're still moving your 2-ton car there, only instead of tomatoes, potatoes, beef and bread, you're only picking up potatoes, beef and bread. You're basically adding 2 trips to the garden store to your travels and subtracting nothing.