One of the challenges of macrophotography is the shallow depth of field at close shooting distances. The stacking method allows the photographer to overcome this challenge to a great extent. The process works this way.
Set the camera on a tripod. Focus on the part of the subject nearest to you. Then, make successive shots focusing in steps on the subject further away from you with each shot. In effect you are creating a “stack “of images. Now, the magic of blending this stack of images into a single image using only the “in focus” portion of each image is done with Photo Merge in Photoshop. Be sure to select “Align images” when you execute Photo Merge.
Notice the background come into focus with each succeeding shot.