For years I have preached to macro photographers that if you want to get everything in focus, shoot in the highest f/stops, f/22 to f/32.
Photographers would say that you should not shoot high f/stop numbers because it causes diffraction.
Diffraction causes a softness in the details when your image comes out of the camera, but it is easily corrected with the sharpening programs we have in our post processing software.
At my flower conference last October, Ted July an attendee gave me a link to an article explaining how diffraction happens and how to correct it.
Here is the link to the article by Jon Rista, "The Diffraction Myth".
https://jonrista.com/2013/03/24/the-diffraction-myth/