How to Display Available Sizes on Your Shopify Collection Page

Tackling the Collection Page Size Dilemma

Ever browsed a Shopify community thread and found a goldmine of a discussion? Recently, a merchant named Geronim0 ran into a classic storefront roadblock: while using the Horizon theme, their collection page proudly displayed prices and colour swatches, but completely omitted product sizes. Customers had no way of knowing at a glance which sizes were actually in stock without clicking into the product page. Frustrating, right?

If you have ever wanted to show available sizes directly on your Shopify collection cards, you are definitely not alone. It is one of those quality-of-life tweaks that can genuinely help boost conversions by saving your shoppers an extra click. Fortunately, the Shopify community stepped up with some brilliant Liquid code and CSS styling to solve this exact issue. Let us walk through how the community cracked this and how you can implement it on your own store.

Setting Up the Custom Liquid Block

The core of the solution involves leveraging Shopify's theme editor to inject a custom snippet directly beneath the product price. Since default theme blocks might not pull size options automatically unless they are set up as swatches, community expert Emelia_InfinitePixel suggested dropping a Custom Liquid block right into the product card layout.

To get this set up on your own store, here are the step-by-step instructions shared in the thread:

  • Go to Online Store > Themes.
  • Click Edit theme on your current theme.
  • Online Store, Themes, Edit theme

  • Click the page name at the top of the editor.
  • Choose Collections, then Default collection.
  • Page name, Collections, Default collection

  • Hover over a price in the preview and click the + that appears under it.
  • The plus button under the price

  • Pick Custom Liquid.
  • Custom Liquid in the block list

  • Paste the following snippet into the Liquid code box:
{%- liquid  assign size_names = 'Size,Glove Size' | split: ','  assign sizes = '|'  for option in closest.product.options_with_values    if size_names contains option.name      assign i = option.position | minus: 1      for variant in closest.product.variants        if variant.available          assign val = variant.options[i]          assign key = '|' | append: val | append: '|'          unless sizes contains key            assign sizes = sizes | append: val | append: '|'          endunless        endif      endfor    endif  endfor  assign sizes = sizes | remove_first: '|' | split: '|'-%}{%- if sizes.size > 0 -%}
{% for s in sizes %}{{ s }}{% endfor %}
{%- endif -%}

Code pasted, sizes showing in the preview

  • Click Save.

Save button

Refining Availability Checks for Complex Variants

As the thread progressed, Geronim0 noticed a small quirk with items like boxing gloves that had multiple colour and size variations—certain in-stock sizes were occasionally missing from the display. This happens because Shopify's default array checking can sometimes restrict results based on the primary option order.

Emelia_InfinitePixel quickly refined the snippet to iterate thoroughly through all variants, making sure any size available in any colour combo shows up properly in neat little horizontal boxes. If you manage an online storefront featuring apparel, footwear, or multi-variant gear, tweaking small code blocks like this gives you complete control over your theme's layout. Whether you are building your store from scratch or optimizing an existing setup, utilizing community-tested solutions can save you hours of trial and error. If you are ready to launch your next project, remember you can always start your Shopify journey today and test out custom tweaks like this right away.

Share:

Start with the tools

Explore migration tools

See options, compare methods, and pick the path that fits your store.

Explore migration tools