<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Pedro Barros</title>
    <description>The latest articles on DEV Community by Pedro Barros (@pedro_barros_0612).</description>
    <link>https://dev.to/pedro_barros_0612</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4103883%2Ffd586dc7-c48a-4503-b313-2c2f3f468dd9.png</url>
      <title>DEV Community: Pedro Barros</title>
      <link>https://dev.to/pedro_barros_0612</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pedro_barros_0612"/>
    <language>en</language>
    <item>
      <title>Klaviyo Campaigns vs. Flows: Explained Simply</title>
      <dc:creator>Pedro Barros</dc:creator>
      <pubDate>Sun, 06 Sep 2026 15:47:04 +0000</pubDate>
      <link>https://dev.to/pedro_barros_0612/klaviyo-campaigns-vs-flows-explained-simply-2nml</link>
      <guid>https://dev.to/pedro_barros_0612/klaviyo-campaigns-vs-flows-explained-simply-2nml</guid>
      <description>&lt;p&gt;If you're using &lt;strong&gt;Klaviyo&lt;/strong&gt; with Shopify, you'll likely work with 2 important features: &lt;strong&gt;Campaigns&lt;/strong&gt; and &lt;strong&gt;Flows&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;They both let you send marketing messages to customers, but they work in different ways.&lt;/p&gt;

&lt;h2&gt;
  
  
  First, What Is Klaviyo?
&lt;/h2&gt;

&lt;p&gt;Klaviyo is a customer data and marketing automation platform commonly used by e-commerce businesses, especially Shopify stores.&lt;/p&gt;

&lt;p&gt;It helps businesses collect customer data, create customer segments, and send personalized email and SMS messages.&lt;/p&gt;

&lt;p&gt;For example, you can use Klaviyo to send welcome emails, abandoned cart reminders, post-purchase messages, and promotional emails.&lt;/p&gt;

&lt;p&gt;Two of the main ways to send these messages are &lt;strong&gt;Campaigns&lt;/strong&gt; and &lt;strong&gt;Flows&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Campaigns vs. Flows
&lt;/h2&gt;

&lt;p&gt;The simplest way to understand the difference is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Campaign = a one-time message sent to an audience.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Flow = an automated message or sequence triggered by customer behavior.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let's break down each one.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;u&gt;Campaigns&lt;/u&gt;
&lt;/h3&gt;

&lt;p&gt;A &lt;strong&gt;Campaign&lt;/strong&gt; is a one-time email or SMS message that you send to a specific audience.&lt;/p&gt;

&lt;p&gt;You decide:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Who receives it&lt;/li&gt;
&lt;li&gt;What the message says&lt;/li&gt;
&lt;li&gt;When it is sent&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, you might send a campaign for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A Black Friday sale&lt;/li&gt;
&lt;li&gt;A new product launch&lt;/li&gt;
&lt;li&gt;A weekly newsletter&lt;/li&gt;
&lt;li&gt;A holiday promotion&lt;/li&gt;
&lt;li&gt;A new collection&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Example
&lt;/h4&gt;

&lt;p&gt;You want to announce a summer sale.&lt;/p&gt;

&lt;p&gt;You create an email:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Summer Sale — 30% Off Everything&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Then you select your audience and schedule the campaign for Friday at 9 AM.&lt;/p&gt;

&lt;p&gt;The email is sent once to the selected audience.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Create Campaign
      ↓
Select Audience
      ↓
Create Email
      ↓
Schedule / Send
      ↓
Customers Receive Email
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;u&gt;Flows&lt;/u&gt;
&lt;/h3&gt;

&lt;p&gt;A &lt;strong&gt;Flow&lt;/strong&gt; is an automated sequence that starts when a customer performs an action or meets a specific condition.&lt;/p&gt;

&lt;p&gt;You create the flow once, and Klaviyo automatically sends the messages based on the flow's timing and conditions.&lt;/p&gt;

&lt;p&gt;Common examples include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Welcome emails&lt;/li&gt;
&lt;li&gt;Abandoned cart reminders&lt;/li&gt;
&lt;li&gt;Post-purchase follow-ups&lt;/li&gt;
&lt;li&gt;Browse abandonment reminders&lt;/li&gt;
&lt;li&gt;Win-back emails&lt;/li&gt;
&lt;li&gt;Review requests&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Example: Welcome Flow
&lt;/h4&gt;

&lt;p&gt;Someone subscribes to your email list.&lt;/p&gt;

&lt;p&gt;That action can trigger a Welcome Flow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Customer subscribes
     ↓
Immediately
Welcome Email
     ↓
3 days later
Brand Story Email
     ↓
7 days later
Discount Offer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Klaviyo automatically sends each message based on the timing you set.&lt;/p&gt;

&lt;h4&gt;
  
  
  Example: Post-Purchase Flow
&lt;/h4&gt;

&lt;p&gt;A customer completes an order.&lt;/p&gt;

&lt;p&gt;You can automatically send:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Customer places order
     ↓
Thank You Email
     ↓
Product Education Email
     ↓
Review Request
     ↓
Cross-Sell Recommendation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The messages can be customized based on your customer's actions and data.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;u&gt;Quick Comparison&lt;/u&gt;
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Campaign&lt;/th&gt;
&lt;th&gt;Flow&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Type&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;One-time&lt;/td&gt;
&lt;td&gt;Automated&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Trigger&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Manual send&lt;/td&gt;
&lt;td&gt;Customer action or event&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Timing&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;You choose&lt;/td&gt;
&lt;td&gt;Based on the flow&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Audience&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;List or segment&lt;/td&gt;
&lt;td&gt;Customers who enter the flow&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Automation&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Black Friday Sale&lt;/td&gt;
&lt;td&gt;Welcome Flow&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Campaigns and Flows serve different purposes in Klaviyo:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Campaigns are for one-time messages.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Flows are for automated customer journeys.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you're managing Klaviyo for a Shopify store, understanding this distinction is important because the two features work together rather than replacing each other.&lt;/p&gt;

&lt;p&gt;Use &lt;strong&gt;Flows&lt;/strong&gt; to automate repetitive marketing tasks and &lt;strong&gt;Campaigns&lt;/strong&gt; when you want to communicate with your audience about something specific at a particular time.&lt;/p&gt;

</description>
      <category>klaviyo</category>
      <category>shopify</category>
      <category>marketing</category>
      <category>ecommerce</category>
    </item>
    <item>
      <title>3 Ways to Add Custom Color and Image Swatches to Shopify</title>
      <dc:creator>Pedro Barros</dc:creator>
      <pubDate>Wed, 02 Sep 2026 08:15:57 +0000</pubDate>
      <link>https://dev.to/pedro_barros_0612/3-ways-to-add-custom-color-and-image-swatches-to-shopify-2mcc</link>
      <guid>https://dev.to/pedro_barros_0612/3-ways-to-add-custom-color-and-image-swatches-to-shopify-2mcc</guid>
      <description>&lt;p&gt;I've implemented Shopify swatches in different ways before, but I noticed that some clients weren't familiar with color swatches or how to set them up properly. So, in this article, I'll explain 3 different ways to implement custom color and image swatches in Shopify stores.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Are Shopify Color Swatches?
&lt;/h2&gt;

&lt;p&gt;Color swatches are a visual way to display product options, such as colors, patterns, materials, or finishes.&lt;/p&gt;

&lt;p&gt;Instead of showing product options as a traditional dropdown or text list:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4nvaxff5fpahukdh8efm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4nvaxff5fpahukdh8efm.png" alt=" " width="463" height="304"&gt;&lt;/a&gt;&lt;br&gt;
A store can display visual options:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F878uybxq499y1tjse3oo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F878uybxq499y1tjse3oo.png" alt=" " width="493" height="150"&gt;&lt;/a&gt;&lt;br&gt;
Depending on the implementation, a swatch can be a simple CSS color, a custom image, or a product image.&lt;/p&gt;

&lt;p&gt;Swatches can be useful on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Product pages&lt;/li&gt;
&lt;li&gt;Collection pages&lt;/li&gt;
&lt;li&gt;Search results&lt;/li&gt;
&lt;li&gt;Quick-view components&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They allow customers to understand product variants more quickly and can make the shopping experience much more visual. There are several ways to implement this on Shopify. The right approach depends on the theme, the store's requirements, and how much customization is needed.&lt;/p&gt;

&lt;p&gt;In this article, I'll cover 3 common approaches:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;u&gt;Shopify Native Color Swatches - Using Category Metafields&lt;/u&gt;&lt;/li&gt;
&lt;li&gt;&lt;u&gt;Filename-Based Swatches - Using Shopify Files in Older Themes&lt;/u&gt;&lt;/li&gt;
&lt;li&gt;&lt;u&gt;Third-Party Shopify Apps&lt;/u&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Each approach has its own advantages and limitations, so the right choice depends on the store's existing setup and requirements.&lt;/p&gt;


&lt;h2&gt;
  
  
  Approach 1: Shopify Native Color Swatches - Using Category Metafields &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;For modern Shopify stores, the &lt;strong&gt;native swatch functionality&lt;/strong&gt; should generally be the first approach to consider.&lt;/p&gt;

&lt;p&gt;Shopify's Standard Product Taxonomy provides &lt;strong&gt;category metafields&lt;/strong&gt; for product attributes such as color. These category metafields can be connected to product variant options, allowing compatible themes to use the associated color or image information to display swatches.&lt;br&gt;
When a product is assigned to a category that supports a color category metafield, you can add or customize color entries and connect that category metafield to the product's &lt;strong&gt;Color variant option&lt;/strong&gt;.&lt;br&gt;
Shopify-compatible themes can then use those values to display color swatches.&lt;/p&gt;
&lt;h3&gt;
  
  
  How it works
&lt;/h3&gt;

&lt;p&gt;First, assign an appropriate product category to the product. This can unlock a Color category metafield.&lt;/p&gt;

&lt;p&gt;You can then add or edit the color entries that you want to use.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Color
├── Black 
├── Navy 
├── Forest Green 
└── White
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each color entry can contain the information Shopify needs to represent the swatch, including a color value or an image.&lt;/p&gt;

&lt;p&gt;Next, connect the Color category metafield to the product's Color variant option.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Color variant option 
├── Black 
├── Navy 
├── Forest Green 
└── White
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The option values are now associated with the corresponding color entries.&lt;/p&gt;

&lt;p&gt;If the theme supports Shopify's native swatches, the theme can render these values automatically as swatches. In themes such as Dawn, the variant picker can use the swatch information supplied by Shopify.&lt;/p&gt;

&lt;h3&gt;
  
  
  Theme customization
&lt;/h3&gt;

&lt;p&gt;One of the biggest advantages of the native approach is that the swatch data is already exposed to the theme through Liquid.&lt;/p&gt;

&lt;p&gt;Shopify provides a &lt;a href="https://shopify.dev/docs/api/liquid/objects/swatch" rel="noopener noreferrer"&gt;&lt;u&gt;swatch object&lt;/u&gt;&lt;/a&gt; with properties such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight liquid"&gt;&lt;code&gt;&lt;span class="cp"&gt;{{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;swatch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;color&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;}}&lt;/span&gt;
&lt;span class="cp"&gt;{{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;swatch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;image&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;}}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A simplified example could look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight liquid"&gt;&lt;code&gt;&lt;span class="cp"&gt;{%&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;value&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;in&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;product_option&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;values&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;%}&lt;/span&gt;
  &lt;span class="cp"&gt;{%&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;swatch&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;%}&lt;/span&gt;
    &lt;span class="cp"&gt;{%&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;swatch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;image&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;%}&lt;/span&gt;
      &amp;lt;img src="&lt;span class="cp"&gt;{{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;swatch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;image&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;image_url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;48&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;}}&lt;/span&gt;" alt="&lt;span class="cp"&gt;{{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;value&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;}}&lt;/span&gt;"&amp;gt;
    &lt;span class="cp"&gt;{%&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;elsif&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;swatch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;color&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;%}&lt;/span&gt;
      &amp;lt;span style="background-color: &lt;span class="cp"&gt;{{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;swatch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;color&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;}}&lt;/span&gt;"&amp;gt;&amp;lt;/span&amp;gt;
    &lt;span class="cp"&gt;{%&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;endif&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;%}&lt;/span&gt;
  &lt;span class="cp"&gt;{%&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;endif&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;%}&lt;/span&gt;
&lt;span class="cp"&gt;{%&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;endfor&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;%}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a simplified example. A production variant picker also needs to handle accessibility, selected states, unavailable variants, variant URLs, and JavaScript interactions.&lt;/p&gt;

&lt;p&gt;The exact implementation depends on the theme, but the important point is that &lt;strong&gt;Shopify provides the swatch data directly&lt;/strong&gt;, so you don't need to build your own filename-matching system.&lt;/p&gt;

&lt;p&gt;Shopify's official swatch implementation also allows themes to control how swatches look and behave, including their shape, styling, and variant-selection behavior.&lt;/p&gt;

&lt;h3&gt;
  
  
  Advantages
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Native Shopify functionality&lt;/li&gt;
&lt;li&gt;No third-party app required&lt;/li&gt;
&lt;li&gt;Structured and reusable color data&lt;/li&gt;
&lt;li&gt;Supports both color and image swatches&lt;/li&gt;
&lt;li&gt;Color entries can be reused across products&lt;/li&gt;
&lt;li&gt;Works well with modern Shopify themes&lt;/li&gt;
&lt;li&gt;Less custom swatch-mapping code compared with older approaches&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Considerations
&lt;/h3&gt;

&lt;p&gt;Your theme needs to support Shopify's native swatches. Shopify notes that compatible themes can display the swatches automatically, while older or unsupported themes may require &lt;strong&gt;theme code customization&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;For a new Shopify store, this is usually the approach I'd check first.&lt;/p&gt;




&lt;h2&gt;
  
  
  Approach 2: Filename-Based Swatches - Using Shopify Files in Older Themes &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Before Shopify's native swatch functionality became available, a common approach was to upload swatch images to &lt;strong&gt;Shopify Admin → Content → Files&lt;/strong&gt; and use the product option value to determine which image should be displayed.&lt;/p&gt;

&lt;p&gt;For example, you could upload:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;black.png
white.png
navy.png
forest-green.png
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Custom theme code can convert the option value into a filename and use that filename to locate the corresponding swatch image.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Black → black.png 
Navy → navy.png 
Forest Green → forest-green.png 
White → white.png
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A simplified example of the kind of Liquid logic used in older themes might look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight liquid"&gt;&lt;code&gt;&lt;span class="cp"&gt;{%&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;value&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;in&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;product_option&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;values&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;%}&lt;/span&gt; 
  &amp;lt;span
    class="swatch"
    style=" background-image: url( &lt;span class="cp"&gt;{{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;value&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;handle&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'.png'&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;file_img_url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'48x48'&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;}}&lt;/span&gt; ); " 
  &amp;gt;&amp;lt;/span&amp;gt; 
&lt;span class="cp"&gt;{%&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;endfor&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;%}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The theme's Liquid/JavaScript logic can map the product option value to the corresponding file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;forest-green
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and the theme looks for:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;forest-green.png
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Why this approach was popular
&lt;/h3&gt;

&lt;p&gt;It was relatively simple and didn't require an app or additional structured data.&lt;/p&gt;

&lt;p&gt;It also gave merchants the ability to use custom images for colors, patterns, materials, or finishes.&lt;/p&gt;

&lt;p&gt;However, it relies heavily on a &lt;strong&gt;specific naming convention&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If the product option is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Forest Green
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;but the uploaded file is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;forest-green-swatch.png
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the theme code needs to account for that difference.&lt;/p&gt;

&lt;p&gt;This approach can therefore become difficult to maintain as the number of products and colors grows.&lt;/p&gt;

&lt;h3&gt;
  
  
  When does this approach still make sense?
&lt;/h3&gt;

&lt;p&gt;I'd mainly consider this approach when working with an &lt;strong&gt;older Shopify theme&lt;/strong&gt; or an &lt;strong&gt;existing store that already uses filename-based swatches&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If you're building a new implementation today, I'd first check whether Shopify's native swatch functionality can meet the requirements.&lt;/p&gt;




&lt;h2&gt;
  
  
  Approach 3: Third-Party Shopify Apps &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;The third option is to use a Shopify app that provides color and image swatch functionality.&lt;/p&gt;

&lt;p&gt;This can be useful when the merchant needs features beyond what the theme's native swatch implementation provides, or when they don't want to make theme-level changes.&lt;/p&gt;

&lt;p&gt;Depending on the app, features can include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Color swatches&lt;/li&gt;
&lt;li&gt;Image swatches&lt;/li&gt;
&lt;li&gt;Pattern swatches&lt;/li&gt;
&lt;li&gt;Swatches on product detail pages&lt;/li&gt;
&lt;li&gt;Swatches on collection pages&lt;/li&gt;
&lt;li&gt;Hover effects&lt;/li&gt;
&lt;li&gt;Variant selection&lt;/li&gt;
&lt;li&gt;Custom swatch layouts&lt;/li&gt;
&lt;li&gt;Advanced swatch management&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The main advantage is convenience. Instead of building and maintaining the functionality yourself, the app provides the functionality and configuration interface.&lt;/p&gt;

&lt;p&gt;The trade-offs are that apps can introduce additional costs, dependencies, and potentially extra frontend code.&lt;/p&gt;

&lt;p&gt;I'd consider an app when the requirements are relatively advanced or when the merchant wants a solution that can be configured without custom theme development.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;For a &lt;strong&gt;new Shopify implementation&lt;/strong&gt;, I'd start with Shopify's native color swatches.&lt;/p&gt;

&lt;p&gt;They provide a structured way to associate color data with variant options, and compatible themes can consume the swatch information directly.&lt;/p&gt;

&lt;p&gt;If you're working on an &lt;strong&gt;older theme that already uses filename-based swatches&lt;/strong&gt;, there's usually no reason to rebuild everything immediately. The existing implementation may continue to work perfectly well.&lt;/p&gt;

&lt;p&gt;Finally, if the merchant needs functionality that isn't conveniently supported by the native theme implementation, a &lt;strong&gt;third-party app&lt;/strong&gt; may be the better choice.&lt;/p&gt;

&lt;p&gt;The important thing is to understand the store's existing setup before choosing an implementation. Sometimes the best Shopify development work isn't writing more code - it's choosing the simplest solution that already fits the requirements&lt;/p&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://gokickflip.com/blog/shopify-color-swatches" rel="noopener noreferrer"&gt;https://gokickflip.com/blog/shopify-color-swatches&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.shopify.com/ca/partners/blog/swatches" rel="noopener noreferrer"&gt;https://www.shopify.com/ca/partners/blog/swatches&lt;/a&gt;&lt;br&gt;
&lt;a href="https://help.switchthemes.co/baseline/guides/color-swatches.html" rel="noopener noreferrer"&gt;https://help.switchthemes.co/baseline/guides/color-swatches.html&lt;/a&gt;&lt;br&gt;
&lt;a href="https://shopify.dev/docs/api/liquid/objects/swatch" rel="noopener noreferrer"&gt;https://shopify.dev/docs/api/liquid/objects/swatch&lt;/a&gt;&lt;/p&gt;

</description>
      <category>shopify</category>
      <category>metafields</category>
      <category>swatches</category>
      <category>ecommerce</category>
    </item>
  </channel>
</rss>
