Shopify Guides

Boost Conversions: Implement a Dynamic Sales Counter on Shopify (No App Needed!)

Hey everyone! As a Shopify migration expert at Shopping Cart Mover, I consistently hear from store owners looking for clever, cost-effective ways to enhance their online presence and build customer trust. One of the most frequently requested features is a 'sales counter' or 'units sold' display on product pages. It's a fantastic tool for social proof, subtly nudging potential customers towards a purchase by showcasing product popularity.

Recently, a lively discussion in the Shopify Community forums, initiated by @kimtime, highlighted this exact need for Dawn theme users wanting an auto-updating sales counter on both collection and product pages. The community, always a treasure trove of insights, provided brilliant, in-depth solutions. I'm breaking down the best of that discussion into a comprehensive guide so you can implement this powerful, conversion-boosting feature on your own Shopify store, all without relying on third-party apps.

Shopify Flow Workflow for Auto-Updating Sales Counter
Shopify Flow Workflow for Auto-Updating Sales Counter

Why a Sales Counter is a Game-Changer for Your Shopify Store

In the competitive world of e-commerce, trust is paramount. When a potential customer lands on a product page, they're looking for reasons to buy. Seeing a dynamic counter that displays 'X units sold' provides instant social proof. It signals popularity, reliability, and can create a sense of urgency or FOMO (Fear Of Missing Out). This small but mighty detail can significantly impact your conversion rates, transforming hesitant browsers into confident buyers. It's a silent salesperson working 24/7.

The Core Approach: Shopify Metafields & Shopify Flow

Community experts like Shawn-Z, Taha_Dev, and Ploqo all converged on the same robust, free, and maintainable solution: leveraging Shopify's native Metafields in conjunction with the powerful automation tool, Shopify Flow. Metafields allow you to store custom data for your products (like a 'sold count'), and Shopify Flow automatically updates this data with every new order. It’s an elegant, built-in solution that keeps your store lean and efficient.

Step-by-Step Guide: Building Your Auto-Updating Sales Counter

1. Creating Your "Sold Count" Metafield

The first step is to create a dedicated space to store your product's sales count. This is where Metafields come in. Both Taha_Dev and Ploqo clearly outlined the process:

  • Go to your Shopify Admin: Settings > Custom data (or Metafields and metaobjects).
  • Click on Products.
  • Click Add definition.
  • For the Name, type Sold count.
  • The Namespace and key will automatically populate as custom.sold_count. This is what you'll reference in your code.
  • For the Type, choose Integer. This ensures the counter only stores whole numbers.
  • Click Save.

2. Seeding the Initial Data (Historical Sales)

You don't want your counter to start from zero if you've already made sales! This step involves populating your new 'Sold count' metafield with your historical sales data. Shawn-Z offered a brilliant time-saving tip for this:

  • Go to Analytics > Reports > Sales by product.
  • Adjust the date range to cover the period you want your counter to reflect (e.g., all-time sales, last year's sales).
  • Export this report or keep it open for reference.
  • Navigate to Products in your Shopify Admin.
  • Use the Bulk editor. Add the 'Sold count' column (you might need to click 'Columns' to find and add it).
  • Paste the sales figures from your report into the corresponding 'Sold count' field for each product. This is much faster than opening each product individually.
  • Click Save.

3. Setting Up Shopify Flow for Automatic Updates

Now for the automation magic! Shopify Flow will ensure your 'Sold count' metafield updates automatically with every new order. This is a free feature available to all Shopify plans (excluding Basic Shopify, where it's part of Shopify Plus or an add-on). Taha_Dev provided the precise steps:

  • Go to Apps > Shopify Flow.
  • Click Create workflow.
  • Trigger: Select Order created.
  • Action: Click the '+' icon, then choose For each > Order > lineItems. This will loop through every item in the order.
  • Inside the loop: Click the '+' icon again, then choose Update product metafield.
  • Configure the 'Update product metafield' action:
    • Product: Select 'the line item's product'.
    • Namespace: Type custom (matching your metafield definition).
    • Key: Type sold_count (matching your metafield definition).
    • Type: Select Integer.
    • Value: Paste the following Liquid code:
      {{ lineItemsForeachitem.product.metafields.custom.sold_count.value | default: 0 | plus: lineItemsForeachitem.quantity }}

      This code retrieves the current 'Sold count', defaults to 0 if none exists, and then adds the quantity of the current line item.

  • Turn the workflow on.
  • Crucial Test: Place one test order to confirm the 'Sold count' actually ticks up on the product page.

4. Displaying the Sales Counter on Your Storefront (Liquid Code)

With the metafield created and Flow automating its updates, the final step is to display this number to your customers. Taha_Dev advises using a Custom Liquid block in your theme editor, especially for Dawn, to prevent theme updates from overwriting your changes. Avoid editing core theme files like price.liquid directly.

For Product Pages:

  • Go to Online Store > Themes > Customize.
  • Navigate to a product page template.
  • Add a Custom Liquid block to the product information section where you want the counter to appear (e.g., near the price or 'add to cart' button).
  • Paste the following Liquid code into the Custom Liquid block:
    {% if product.metafields.custom.sold_count.value > 0 %}
      

    {{ product.metafields.custom.sold_count.value }} units sold!

    {% endif %}

    You can customize the text and styling (e.g., add a class for CSS styling).

For Collection Pages (Product Cards):

  • This is slightly more advanced and might require editing a snippet or creating a custom block for product cards.
  • Locate the snippet responsible for rendering product cards (e.g., card-product.liquid or a similar file within the snippets folder).
  • Add a small snippet or block that prints product.metafields.custom.sold_count within the product card's structure, similar to the product page example.

Important Caveats to Keep in Mind

  • Refunds/Cancellations: The default Flow setup only increments the count. If an order is refunded or cancelled, the number won't automatically decrease. You'll need to build a second Shopify Flow workflow triggered by 'Order refunded' or 'Order cancelled' to subtract the quantity.
  • Multiple Variants of the Same Product in One Order: If a single order contains, for example, two different variants of the *same* product (e.g., a T-shirt in size S and size M), a simple 'For each line item' loop in Flow can sometimes overwrite itself and under-count. For most catalogs, this is rare. If it's a concern for your store, Taha_Dev suggests using a 'Run code' step in Flow to sum quantities per product ID once, then update each product only once. This requires more advanced Liquid scripting.
  • Theme Updates: Always prefer using Custom Liquid blocks in the theme editor over directly editing core theme files. This ensures your customizations are less likely to be wiped out during theme updates.

Conclusion

Implementing a dynamic sales counter using Shopify Metafields and Flow is a powerful, free way to inject social proof into your store, enhance customer trust, and ultimately boost your conversion rates. It's a testament to the flexibility and robustness of the Shopify platform. While the initial setup requires a few steps, the long-term benefits of an auto-updating, trust-building feature are immense.

At Shopping Cart Mover, we specialize in helping businesses optimize their Shopify stores and ensure smooth migrations. If you're looking to enhance your store's functionality or considering a migration to Shopify, don't hesitate to reach out to our experts!

Share:

Use cases

Explore use cases

Agencies, store owners, enterprise — find the migration path that fits.

Explore use cases