StoreFront Filtering // Updating a value outside of the firm based on the filtered output

Chris_Sydney
Shopify Partner
84 4 15

Hey There,

 

I am working on trying to get the {{ filter_value.label }} out of the filter

 

 

 

{%- for filter_value in filter.active_values -%}
          {%- assign filter_count = filter_count | plus: 1 -%}
          <a class="filter__active__remove" href="{{ filter_value.url_to_remove }}" data-filter-reset-button>
            {{ filter_value.label }}
            <span class="filter__x">✕</span>
          </a>
          <script type="text/javascript">
            var filterLabel = "{{ filter_value.label }}";
            console.log(filterLabel);
          </script>
        {%- endfor -%}

 

 

 

Currently, I am trying to console.log() the output to confirm the logic works, but for some reason I cant get updates on the page after initial load. im assuming this is form so I would have expected it to run the script again after something is selected. 

 

any ideas? Also, where is the filter active stored? I lookied in localstorage, but couldnt find it. 

 

Replies 2 (2)

Rishihuptech
Shopify Partner
351 63 68

Hello @Chris_Sydney ,

 

Can you please provide more details about this? Which theme you are using, The store URL, and why do you want to get the {{ filter_value.label }} out of the filter?

If you found this response helpful, please do like and accept the solution. Thanks!
Need support with Customizing your Shopify store?
Feel free to contact me at info@huptechweb.com or Visit our website Huptech Web.
Instant Shortcode Builder: Integrate customizable UI features anywhere in your store - No coding knowledge required
Chris_Sydney
Shopify Partner
84 4 15

Sorry Its in a sanbox at the moment. 

 

I want to get that value out of the filter, so I can use it in the header title.

 

IE: instead of having multiple collections, where a customer needs to navigate to another /collection/X to see different items, I wanted to take them to collections/all and then control the header title and image via the filter.


I only have 4 options that I want to filter against, so really only 4x4. = 16 different header names and images for header image.