Boost Trust & Sales: How to Add an Auto-Updating 'Units Sold' Counter to Your Shopify Store
Hey fellow store owners!
Want to build instant trust and nudge those undecided shoppers towards a purchase? A 'units sold' counter – showing how many of a product have already found happy homes – is pure gold for social proof. Our friend @kimtime recently asked the community how to implement one for their Dawn theme store, visible on both product and collection pages.
While Shopify doesn't offer this natively, our community experts – like @Shawn-Z, @Taha_Dev, and @Ploqo – provided a robust, free solution. It leverages Metafields to store the count, Shopify Flow to automate updates, and Liquid code for display. This DIY approach makes excellent use of Shopify's built-in tools. Let's dive in!
Step 1: Create Your 'Sold Count' Metafield
This metafield will store the number of units sold for each product.
- Go to your Shopify Admin: Settings > Custom data > Products.
- Click Add definition.
- Name:
Sold count(namespace/key:custom.sold_count). Type: Integer. - Click Save.
Step 2: Seed Your Initial Sales Data
Flow only counts new orders once activated, so historical sales must be populated first:
- Few products: Go to Products, open each, enter past sales into the Sold count metafield, and Save.
- Many products (bulk edit): Use Analytics > Reports > Sales by product to get totals. Then, in Products, use the Bulk editor to add the Sold count column and paste numbers.
Step 3: Automate with Shopify Flow
This Flow workflow increments your 'Sold count' metafield for every new order. Flow is free for most Shopify plans!
- Go to Apps > Flow > Create workflow.
- Trigger: Order created.
- Action: For each > Order > lineItems.
- Inside the loop: Update product metafield.
- Product: "the line item's product"
- Namespace:
custom - Key:
sold_count - Type: Integer
- Value:
{{ lineItemsForeachitem.product.metafields.custom.sold_count.value | default: 0 | plus: lineItemsForeachitem.quantity }}
- Turn the workflow on. Always place a test order to confirm it works!
Step 4: Display on Your Storefront (Dawn Theme)
Time to show off those sales! For product pages, using a "Custom liquid" block in the theme editor is recommended for future theme update safety.
- Go to Online Store > Themes > Customize.
- Navigate to a product page. In the left sidebar, click Add block where you want the counter (e.g., under the price) and choose Custom liquid.
- Paste this code into the Custom Liquid block:
{%- if product and product.metafields.custom.sold_count.value > 0 -%}{{ product.metafields.custom.sold_count.value }} sold
{%- endif -%} - Click Save.
For collection pages, displaying the counter on each product card usually requires editing the theme code directly (e.g., in a snippet like card-product.liquid) to print product.metafields.custom.sold_count within the product card loop. This is more advanced.
Here's a visual from @Ploqo showing the 'After' effect on a collection page:
After: Collection Page with Sold Counter
Important Caveats
A few things to remember for accuracy:
- Refunds/Cancellations: This Flow setup only adds to the count. To decrease the number, a second Flow workflow is needed, as @Shawn-Z and @Taha_Dev noted.
- Multiple Variants: If an order has multiple variants of the same product, Flow can sometimes under-count. A more advanced "Run code" step could sum quantities per product ID reliably.
- Theme Updates: While "Custom Liquid" blocks are robust, direct theme code edits for collection pages could be overwritten. Always back up your theme!
Looking for an Easier Way? Consider an App
If the DIY route feels too technical or you need more advanced features, a dedicated app might be a better fit. @Ploqo suggested options like "Sold Count: Low Stock Counter" or "Sold Count: Product Sale Proof." These offer a more hands-off experience for a monthly subscription.
There you have it! A powerful way to add social proof to your Shopify store, directly leveraging its own features. It takes a little setup, but the impact on customer confidence and sales can be well worth the effort. Happy selling!




