Boost Trust & Sales: How to Add an Auto-Updating 'Units Sold' Counter to Your Shopify Store
Hey everyone! As a Shopify expert and community analyst, I often see store owners looking for clever ways to boost trust without relying solely on paid apps. A common request is how to add a 'sales counter' or 'units sold' display to product pages – it's fantastic for social proof and nudging customers towards a purchase.
Recently, a great discussion popped up in the forums, started by @kimtime. They were using the Dawn theme and wanted to integrate a sales counter on both collection and product pages, with automatic tracking after initial setup. The community, as always, came through with brilliant, in-depth answers. I'm breaking down the best of that discussion so you can implement this powerful feature on your own Shopify store.
Why a Sales Counter Matters
Why bother with a sales counter? In the online world, trust is everything. Seeing that a product has sold hundreds of times signals popularity and reliability – classic social proof. This small detail can significantly impact conversion rates, turning browsers into buyers.
The Core Approach: Metafields & Shopify Flow
Community experts like Shawn-Z, Taha_Dev, and Ploqo agree: the most robust, free, and maintainable way to get an auto-updating sales counter without an external app is by combining Shopify's native Metafields and the powerful automation tool, Shopify Flow. Metafields store custom data (like 'sold count'), and Flow automatically updates it with every new order. Let's walk through it.
Step-by-Step Guide
1. Creating Your "Sold Count" Metafield
First things first, we need a place to store our product's sales count. This is where Metafields come in. Both Taha_Dev and Ploqo laid out the steps clearly:
- 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 important for our Liquid code later. - For the Type, choose Integer.
- Click Save.



2. Seeding Your Historical Data
As @kimtime rightly asked, Flow only counts new orders. So, for all your past sales, you'll need to 'seed' this metafield once. Shawn-Z offered a super-efficient tip:
- Go to Analytics > Reports > Sales by product. Choose your desired date range to get historical sales numbers.
- Now, go to Products in your Shopify Admin.
- Select multiple products (or all of them) and use the Bulk editor.
- Add the Sold count column (it should now appear).
- Paste the historical sales numbers into the corresponding products' Sold count fields.
- Click Save. This is way faster than opening each product individually!

3. Automating the Count with Shopify Flow
This is where the magic happens! Taha_Dev provided a fantastic breakdown of how to set up Shopify Flow to automatically increment your Sold count metafield with every new order:
- Go to Apps > Flow > Create workflow.
- Trigger: Choose Order created.
- Action: Add an action for For each > Order > lineItems. This loop ensures Flow processes each item in an order.
- Inside the loop: Add an action for Update product metafield.
- Product: Select
the line item's product. - Namespace: Type
custom. - Key: Type
sold_count. - Type: Choose Integer.
- Value: Paste this Liquid code exactly as it is:
This code gets the current{{ lineItemsForeachitem.product.metafields.custom.sold_count.value | default: 0 | plus: lineItemsForeachitem.quantity }}sold_count(defaulting to 0 if none exists) and adds the quantity of the current line item.
- Product: Select
- Turn the workflow on.
- Important Test: As Shawn-Z advised, place one test order yourself to make sure the count actually changes on the product page.
4. Displaying the Counter on Your Storefront (Dawn Theme)
Now that the data is there, let's make it visible! @kimtime mentioned using the Dawn theme, and both Ploqo and Taha_Dev offered solutions. Taha_Dev wisely suggested using a Custom liquid block to avoid theme updates wiping your changes, which is generally a best practice for modern themes.
Option A: Recommended (Custom Liquid Block)
This method is more resilient to theme updates:
- Go to Online Store > Themes.
- Click Customize on your current theme (Dawn).
- Navigate to a product page or collection page where you want the counter to appear.
- In the theme editor, find the section where you want to add the counter (e.g., under the price on the product page, or within a product card on a collection page).
- Add a new block or section, and choose Custom liquid.
- Paste the following Liquid code into the custom liquid block:
{%- if product and product.metafields.custom.sold_count.value > 0 -%}{{ product.metafields.custom.sold_count.value }} sold
{%- endif -%} - Adjust the
styleattributes if you want to change the appearance (font size, color, margin). - Click Save.
Option B: Quick & Dirty (Editing price.liquid)
Ploqo provided a direct edit to price.liquid, which is quicker but might be overwritten if you update your theme. Use with caution.
- Go to Online Store > Themes. Click the three dots on your current theme, then Edit code.
- Under Snippets, open
price.liquid. - Scroll to the bottom. Find the line
{% endunless %}. - Paste the exact same Liquid code from above just before that line:
{%- if product and product.metafields.custom.sold_count.value > 0 -%}{{ product.metafields.custom.sold_count.value }} sold
{%- endif -%} - Click Save.
Here are some visuals from Ploqo demonstrating the 'before' and 'after':
Before:


After:


Important Considerations & Pro Tips
While this custom solution is incredibly powerful, our community experts highlighted a few important caveats you should be aware of:
- Refunds and Cancellations: Both Shawn-Z and Taha_Dev pointed out that this Flow workflow only adds to the count. If an order is refunded or canceled, the
Sold countwon't automatically decrease. To handle this, you'd need to build a separate Shopify Flow workflow specifically for those events, which is more advanced but doable. - Multiple Variants in One Order: Taha_Dev raised a subtle but important point: if a single order contains multiple variants of the same product, the
For each lineItemsloop could potentially under-count. For most stores, this is rare, but if it's a concern, Taha_Dev suggested using a Run code step in Flow to sum quantities per product ID first, then update each product once. This requires more Liquid/code expertise. - Theme Updates: As mentioned, if you're directly editing core theme files like
price.liquid, future theme updates might overwrite your changes. Sticking to Custom liquid blocks within the theme editor is generally the safer, more future-proof approach for Dawn and other modern themes.
Alternative: Ready-Made Apps
If Metafields and Flow feel too technical, or you need more advanced features like real-time updates for refunds or highly customizable display options, ready-made apps are always an option. Ploqo listed a few worth exploring:
- Sold Count: Low Stock Counter
- Sold Count: Product Sale Proof
- Stock Sheep - Sold & Low Stock
These apps often come with a monthly fee but can offer a plug-and-play solution with less manual setup.
There you have it! Thanks to the fantastic insights from Shawn-Z, Taha_Dev, and Ploqo, you now have a comprehensive guide to implementing an auto-updating sales counter on your Shopify store. It's a prime example of leveraging Shopify's built-in tools like Metafields and Flow for powerful customization without breaking the bank. Experiment, test thoroughly, and watch that social proof work its magic on your conversions. Happy selling!