Unlock Barcode-Based Sales Reports in Shopify: Community Solutions & Workarounds

Hey fellow store owners! As a Shopify migration expert and someone who loves digging into what makes our community tick, I often come across discussions that really highlight practical challenges we all face. Recently, a thread titled "Filter request for reports" caught my eye, started by a merchant named verde-home-gifts. It’s a classic example of needing specific data that isn’t immediately available in Shopify’s standard reports, and the community really came through with some clever workarounds.

The core issue? Many of us use SKUs for vendor codes, but rely on barcodes for our internal selling codes and tracking product ranges. The problem, as verde-home-gifts eloquently put it, is that "we aren’t able to do a report of sales made on a day using the barcode as a filter. Seems a bit crazy." They requested a crucial feature: the ability to add product variant barcode as a filter in sales reports, enabling merchants to count units sold by barcode prefix across both Online Store and POS.

The Reporting Gap: Why Barcodes Aren't Directly Filterable

It turns out, as community member alaattincagil pointed out after a quick check, product_variant_barcode isn't a dimension in the sales dataset at all. This means it's not just a missing filter; it's a structural gap in how sales data is currently reported. So, while the feature request is absolutely valid and needed, what do you do in the meantime?

Thankfully, our community is full of resourceful merchants and experts who've pieced together some excellent strategies to bridge this gap. Let's dive into the two main approaches that emerged from the discussion.

Solution 1: The Spreadsheet Power-Up (CSV Export & Manual Analysis)

This is probably the most robust solution for complex scenarios, especially if different variants of the same product have unique barcode prefixes. Both One-Sun1995 and Lamypno laid out clear steps for this method, emphasizing its reliability.

How it Works:

The idea here is to combine two key data exports from Shopify: your daily orders and your product catalog. By joining these two datasets outside of Shopify (typically in a spreadsheet program like Excel or Google Sheets), you can enrich each order line item with its corresponding barcode and then perform your analysis.

Step-by-Step Instructions:

  1. Export Your Orders: Go to your Shopify admin, navigate to Orders, and click the "Export" button. Choose to export orders for the desired day (or date range). This CSV file will contain a column called "Lineitem sku" for every product sold. Crucially, this export covers both POS and online orders, so you get a comprehensive view.
  2. Export Your Products: Next, head to Products in your Shopify admin and click the "Export" button. This export will give you a CSV file containing all your products and their variants. Look for columns like "Variant SKU" and "Variant Barcode" (or similar names, depending on your Shopify version).
  3. Join the Data in a Spreadsheet: Open both CSV files in your preferred spreadsheet program. You'll want to use a lookup function (like VLOOKUP in Excel or INDEX/MATCH) to match the "Lineitem sku" from your orders file with the "Variant SKU" in your products file. This will allow you to pull the "Variant Barcode" for each sold item directly into your orders sheet.
  4. Extract Barcode Prefixes: Once you have the full barcode for each sold item, you can create a new column to extract the prefix you're interested in. For example, if you want the first three characters, you'd use a formula like =LEFT(barcode_column, 3).
  5. Pivot for Analysis: Finally, use a pivot table (or similar data aggregation tool) on your enriched orders data. You can then pivot by your new "Barcode Prefix" column and sum the "Quantity" sold for each day. This gives you exactly what verde-home-gifts was looking for: units sold by barcode prefix.

Lamypno specifically noted that while this "takes a few minutes once the sheet exists," it "can be automated so you just open the sheet each morning" – a huge time-saver for daily reporting!

Solution 2: Inside Shopify with ShopifyQL & Product Tags

If you prefer to stay within the Shopify admin as much as possible, alaattincagil offered a brilliant workaround using ShopifyQL and product tags. This method is particularly elegant because it allows you to save a custom report right inside your Shopify Analytics.

How it Works:

Since product_variant_barcode isn't a direct filter, alaattincagil's insight was to leverage something that is filterable: product tags. By tagging your products with their barcode range, you can then use ShopifyQL to query sales based on these tags.

Step-by-Step Instructions:

  1. Tag Your Products: This is the crucial setup step. You'll need to tag each product with a tag representing its barcode prefix or range. For example, if barcodes start with "ABC", you might use the tag range-ABC. If you have many products, alaattincagil suggested using your existing product export (from Solution 1, step 2) to fill the "Tags" column based on your barcode prefixes and then re-importing the CSV. Important: When re-importing, make sure to keep any existing tags in that column, as the import replaces them.
  2. Create a New Report in Analytics: In your Shopify admin, go to Analytics > Reports. Click on "Custom reports" and then "Create custom report."
  3. Open the ShopifyQL Editor: You'll see an option to "Open ShopifyQL editor." Click this to access the query interface.
  4. Run Your ShopifyQL Query: Paste the following code into the editor, adjusting 'range-ABC' to match the tag you've used:
    FROM sales
      SHOW net_items_sold, net_sales
      WHERE product_tags CONTAINS 'range-ABC'
      GROUP BY day, is_pos_sale
      SINCE -7d UNTIL today
      ORDER BY day DESC
    

    This query will show you the net items sold and net sales for products tagged with 'range-ABC', grouped by day and splitting out POS sales from online sales (is_pos_sale). If you only want one total per day, you can simply drop is_pos_sale from the GROUP BY clause.

  5. Save Your Report: Once you've run the query and confirmed it's working, save the report. Now, it'll be available in your custom reports for easy access every morning!

The Catch with ShopifyQL & Tags:

Alaattincagil wisely pointed out one significant limitation: "tags live on the product, not the variant." This means this method only works if all variants of a specific product share the same barcode prefix. If you have a product where Variant A's barcode starts with "ABC" and Variant B's starts with "XYZ", tagging the product with range-ABC would incorrectly include sales of Variant B if it happened to be within the same product. In such cases, the spreadsheet export route (Solution 1) is the more reliable option.

Choosing Your Path

So, which method is right for you? If your products generally have consistent barcode prefixes across all their variants, the ShopifyQL method is a fantastic way to get automated, in-platform reports. It's a bit more setup initially with the tagging, but then it's smooth sailing.

However, if your variant barcodes are truly diverse and you need to filter sales at that granular variant-specific barcode level, the CSV export and spreadsheet analysis method is your best bet. It requires a bit more manual work daily (or setting up an automation), but it offers unmatched flexibility and accuracy for those complex scenarios.

It's truly inspiring to see how our community comes together to find clever solutions to these kinds of challenges. While we all hope Shopify adds a native barcode filter to reports soon, these workarounds shared by One-Sun1995, Lamypno, and alaattincagil definitely save the day for many merchants in the meantime. Big thanks to them for sharing their expertise!

Share:

Use cases

Explore use cases

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

Explore use cases