Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Shopify Catalog to n8n Thumbnails: Step-by-Step

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

This guide walks you through creating product page thumbnails from a Shopify catalog using n8n, a workflow automation tool. You’ll learn how to pull product data from Shopify, generate or fetch thumbnail images, and save them where you need them—all without writing code. Before starting, you’ll need a Shopify store with product data, an n8n instance (self-hosted or cloud), and access to an image generation service (like OpenAI’s DALL·E) or a stock image API if you don’t already have thumbnails. We’ll use n8n’s visual workflow builder to connect these services.

What You'll Need

  • An n8n instance (cloud or self-hosted) with admin access.
  • A Shopify store with products and an API key or access token (Admin API).
  • An image generation API key (e.g., OpenAI) or a source for existing images (e.g., Shopify product images).
  • Basic familiarity with n8n’s node-based interface.

Step-by-Step

  1. Log in to n8n and create a new workflow. Click “Workflows” in the left sidebar, then “Add Workflow.” Name it something like “Shopify Thumbnail Generator.”
  2. Add a Shopify Trigger node. Drag a “Shopify Trigger” node onto the canvas. Choose an event like “Product Created” or “Product Updated” to start the workflow when a product changes. If you prefer to process the entire catalog on demand, use a “Schedule Trigger” (cron) or a “Manual Trigger” instead.
  3. Configure the Shopify credentials. Click the trigger node and select “Create new credential.” Enter your Shopify store URL (e.g., your-store.myshopify.com) and the Admin API access token. In Shopify, generate the token in Admin > Apps > Develop apps > Create an app, then assign the “Read products” scope. Save the credential.
  4. Add a “Shopify: Get Many Products” node. Drag this node after the trigger. Connect it, then select the same credential. Set “Limit” to a number like 50 to avoid overwhelming the API. You can also add filters (e.g., only products with a certain tag) using the “Filter” field.
  5. Add a “Loop Over Items” node. Connect it to the “Get Many Products” node. This will process each product one by one. In its settings, set “Batch Size” to 1 to keep it simple.
  6. Extract product details. Add a “Set” node inside the loop. Use expressions to pull the product ID, title, and any existing image URL. For example: for the title, for the ID. If the product has an image, you can use that later; otherwise, you’ll generate one.
  7. Check if a thumbnail already exists. Add an “IF” node. In the condition, check if the product’s image field is not empty. If it has an image, you can skip generation and just use that URL. If not, proceed to generate one.
  8. Generate a thumbnail image. For products without an image, add an “OpenAI” node (or your preferred image generation service). Configure it to use the “Create Image” operation. Set the size to “256x256” or “512x512” depending on your needs.
  9. Save the generated image. Add a “Write Binary File” node (if you want to store it locally) or a “Google Drive” / “Amazon S3” node to upload the image. For n8n cloud, you might use an HTTP Request node to POST the image to a storage service. Alternatively, you can just keep the URL from the OpenAI response.
  10. Update the Shopify product with the thumbnail. Add a “Shopify: Update Product” node. Connect it after the image is saved. Set the product ID (from the loop) and provide the image URL or binary data. In Shopify’s API, you can set the “image” field with a source URL. For binary, you’d need to upload via the API’s image upload endpoint—n8n’s Shopify node supports this by selecting “Update Product” and providing the image data.
  11. Add error handling. Connect an “Error Trigger” node to the workflow’s canvas (not in the loop) to catch any failures. Log errors to a file or send a notification via email or Slack.
  12. Activate the workflow. Click “Save” and then toggle “Active” to enable it. Test with a single product first by using the “Execute Workflow” button.

Common Mistakes

  • Using the wrong API scope. Shopify requires the read_products and write_products scopes for this workflow. If you get 403 errors, check your app’s scopes.
  • Not handling rate limits. Shopify and OpenAI have rate limits. If you process many products at once, you may hit 429 errors. Add a “Wait” node (e.g., 1 second) between loop iterations.
  • Assuming every product has an image. Many products lack images. Your IF node must handle that case, or the workflow will fail.
  • Forgetting to update the product. Generating the image is only half the job—you must actually save the URL back to Shopify, or the thumbnail won’t appear on the storefront.
  • Using binary data incorrectly. When updating Shopify, you can provide an image URL directly, but if you’re sending binary data, you need to use the correct multipart form format. The n8n Shopify node handles this if you select “Binary” for the image field.

Tips

  • Test with a few products first. Run the workflow manually with a small batch to verify the image generation and update work before processing the entire catalog.
  • Use a consistent prompt style. For cohesive thumbnails, include brand-specific keywords in the prompt, like “minimalist” or “vibrant.”
  • Cache existing images. If a product already has an image, skip generation to save API costs.
  • Set a reasonable image size. 512x512 is a good balance for Shopify product thumbnails; larger sizes slow down page load.
  • Monitor costs. Image generation APIs charge per image. Estimate your catalog size and set a budget or limit in the workflow.

Troubleshooting

Workflow fails with “Invalid credentials.” Double-check your Shopify API token and store URL. Ensure the token has the correct scopes and hasn’t expired.

No images generated. Check the OpenAI node’s response—it may be failing due to an invalid prompt or insufficient credits. Test the node alone with a static prompt first.

Products not updating. Verify that the “Update Product” node receives the correct product ID. Use the n8n “Execute Workflow” with a single item and inspect the output of each node.

Rate limit errors (429). Add a “Wait” node set to 1-2 seconds inside the loop. Also, consider using n8n’s built-in “Retry” on failure settings for API calls.

Images appear broken on Shopify. Ensure the image URL is publicly accessible. If using a local file, upload it to a public storage service first.

Frequently Asked Questions

Can I use a free image generation service? Yes, you can use any HTTP API. Some free tiers exist, but they often have limitations. Alternatively, you can pull images from Unsplash via their API, but those won’t be product-specific.

Do I need to use OpenAI specifically? No. n8n supports many services like Stability AI, or you can use a custom HTTP Request node to any image API.

Can I process the entire catalog at once? Yes, but be mindful of rate limits. The loop node processes items sequentially, so it may take time. You can increase the batch size to speed up, but that risks hitting API limits.

What if I only want to generate thumbnails for new products? Use the “Shopify Trigger” with “Product Created” event instead of a schedule. That way, only new products are processed.

Can I store thumbnails in Shopify’s CDN? Yes, when you update the product with an image URL, Shopify automatically proxies it through its CDN. That’s the recommended approach.

Is there a way to preview the workflow before running? Yes, you can use n8n’s “Execute Workflow” button, which lets you run the workflow with sample data. You can also add a “NoOp” node to inspect data at any point.