Published on

How We Taught Ourselves to Tame the Studio Theme Beast Removing Search Filters

Authors
  • avatar
    Name
    Entaice Braintrust
    Twitter

How We Taught Ourselves to Tame the Studio Theme Beast: Removing Search Filters

The saga of the Studio theme search filter experiment began in the most mundane of places: with our collective heads buried deep in our screens, only to be interrupted by the ferocious growl of two unwieldy search filters—Availability and Price—staring back at us from our collections page. A challenge worthy of our prowess, we decided right then and there that we would embark on a journey to conquer this Shopify beast.

So, here we are, disorganized yet enthusiastic warriors, ready to guide you through the treacherous terrain of custom code. We humbly admit we are not experts. But let's dive head-first—a trusted friend by your side—and unravel the secrets of these pesky filters together.

The Great Search for the Filter Oracle

Imagine us huddled around a single flickering candle, in a darkened room—a zenith of focus—and an old dusty tome before us ... Alright, maybe it wasn’t quite that dramatic, but we started with a web search. The Elasticsearch fairy wasn't going to throw us a bone for something so specific. So, we forged ahead with one clear directive: getting those filters out of our lives.

We took that brave first step and logged into our Shopify admin panel. It’s like walking into the control room of a starship, only you’re not quite sure which button will teleport you into an alternate dimension. Undeterred, we journeyed over to the 'Themes' section under 'Online Store' and clicked 'Actions' followed by 'Edit Code.' With the curious anticipation of miners digging for gold, we opened the liquid files of our Studio theme.

Unlocked the Hidden Path: Code Reveals Itself

Our fingers trembled with a cocktail of excitement and uncertainty, like trying to deactivate a bomb—or possibly just craving a Snickers. We navigated to the 'Sections' folder and opened the collection-template.liquid file. Within this digital cavern, lay our likely foe.

“Oh, sweet lines of code... what wonders and horrors do you hold?” Declared none of us in our stressed state. Instead, we haphazardly scanned the text for words like ‘price’ and ‘availability.’ It turns out, these search filters that taunted us have a sneaky hold in the filter settings.

Here’s what we did: in the file, look for the following lines that define filter controls:

{% if settings.enable_availability_filter %}
  {% include 'filter-availability' %}
{% endif %}
{% if settings.enable_price_filter %}
  {% include 'filter-price' %}
{% endif %}

To banish these filter devils, we simply—drumroll, please—deleted the lines completely or starred them out with the trusty {% comment %} and {% endcomment %} Liquid tags to preserve our sanity:

{% comment %}
{% if settings.enable_availability_filter %}
  {% include 'filter-availability' %}
{% endif %}
{% if settings.enable_price_filter %}
  {% include 'filter-price' %}
{% endif %}
{% endcomment %}

Victory! Small ones, like finding that single missing sock from the dryer universe, are the sweetest.

Moments of Reflection: An Uneasy Peace

After a bout of panic-inducing refreshes and quickened heartbeats—thank you, caching gods—we cheered in triumph as the elements disappeared from our collections page. Oh, sweet relief. There’s an unmatched euphoria when a plan comes together, no filters in sight, just welcoming open space for our eye-gazing products to shine through.

Let's not forget, in this journey, our newfound understanding of the digital underbelly of Studio themes. We gained a little bit more respect for those who wrangle with code day in and day out. Not all heroes wear capes, some wield liquid.

We spent a few moments savoring our victory, maybe swinging arms in the air like middle-schoolers who discovered a cheat sheet to algebra. But we also noted: it’s wise to keep backups and befriend developers, because as much as this was a win, we danced close to the edge.

Until Next We Meet: Scripting Adventure Awaits

When the confetti of our small coding victory settled, we found ourselves already craving the next adventure—the next story to unravel in the labyrinthine corridors of Shopify themes. Today, it was about filters, tomorrow, who knows? Let’s raise our virtual steins (or mouse cursors) high to more mysteries, more dauntless feats.

There's a world of code out there waiting to be explored, and we're just eager enough to embark on our next thrilling quest together. Whether you're a novice like us or a seasoned pro, here's to the audacious spirit that guides our curious souls.

Cheers, comrades in code!