How to implement a proper soft-404 for invalid collection sub-URLs in Shopify OS 2.0 (without redirecting the URL)

Hi everyone,

I’m working on a Shopify OS 2.0 store and facing an SEO-related issue with invalid collection sub-URLs, and I’d like confirmation on best practices or limitations.

Problem

Shopify allows URLs like:

  • /collections/office-for-mac/word

  • /collections/office-for-mac/abcd

Even though:

  • word or abcd are not real collections

  • They are not valid tags in some cases

  • The URL should ideally behave like a 404

Instead, Shopify either:

  • Redirects some URLs back to the parent collection, or

  • Renders the full collection page content

This has resulted in soft-404 URLs being indexed by Google.

What I’m trying to achieve
For URLs like:
/collections/{collection-handle}/{anything-invalid}
I want:

  • :white_check_mark: URL to stay the same (no redirect)

  • :white_check_mark: Page UI to show 404 content

  • :white_check_mark: Meta title to be “404 – Page not found”

  • :white_check_mark: noindex, nofollow for SEO

  • :cross_mark: No products / filters / banners rendered

Essentially, a soft-404 that Google understands correctly.
What I’ve learned so far

  • Shopify OS 2.0 does not allow returning a real 404 HTTP status for collection pages

  • {% return %} is not supported

  • You cannot render a section (main-404) inside another section

  • Each section renders independently, so injecting a 404 does not stop other sections

  • The only workable solution seems to be conditionally suppressing all collection sections and rendering a single 404 UI

Current approach

At the top of each collection section, I detect invalid paths like this:
{% liquid
assign path_parts = request.path | remove: ‘/collections/’ | split: ‘/’
assign is_invalid_collection_url = false

if path_parts.size > 1 and path_parts[1] != blank
assign is_invalid_collection_url = true
endif
%}

Then:

  • All collection sections do not render if is_invalid_collection_url == true

  • One section renders a custom 404 UI

  • Meta title is updated via JavaScript

  • Robots meta is set to noindex, nofollow

This works visually, but it feels like a workaround.
My questions

  1. Is this the recommended / accepted approach for soft-404s in Shopify OS 2.0?

  2. Is there any cleaner way to:

    • Prevent collection sections from rendering

    • Or signal Google more clearly without redirects?

  3. Is Shopify planning any native support for handling invalid collection sub-paths?

Any confirmation, improvements, or alternative ideas would be greatly appreciated :folded_hands:

Thanks!