How do I get a product's slideshow gallery to automatically switch to the correct variant image?

To get a product's slideshow gallery to automatically switch to the correct variant image, you'll need to add/select an image for each variant within the Shopify admin. Here's how to do that:

  1. In the Shopify admin, navigate to the product you want to edit.
  2. Scroll down to the list of variants.
  3. Click the small image thumbnail to the left of the variant title.
  4. This will open a box to select from the available images that are associated with the product (i.e. any image that you've uploaded to the product's "main" media).
  5. Select the image for that variant (or upload a new one). (Note that you can use the same image for multiple variants! i.e. If you have a t-shirt product with red, blue, and black variants, which are also available in small, medium, and large — you would add the red t-shirt image to all red variants (i.e. the red/small variant, the red/medium variant, and the red/large variant... Unless you actually have different images for these!)
  6. Save your work.

Here's a quick screencapture of the process:

Align theme