Filter Functionality Issue and Errors

Filter Functionality Issue and Errors

manbru
Pathfinder
129 0 30

Hey,

 

I'm having some trouble with my filters they don't work as you can see in the image i can check any box but nothing happens, i have tried looking into the code but have not been able to fix it. Then i found all these errors and thought it might have to do something with it.

 

my store: https://r1vex.myshopify.com/

 

 

Skärmavbild 2024-07-17 kl. 07.42.40.png

Replies 6 (6)

WalkYourStyle
Navigator
475 58 79

Go to 'Online Store' -> Theme -> Edit Code, locate the file 'facets.js' find line 65 and add backticks to the template literal like this:

const url = `${window.location.pathname}?section_id=${section.section}&${searchParams}`;
manbru
Pathfinder
129 0 30

bruv my coding skills ain't good, how do i know what backticks to add to the template

WalkYourStyle
Navigator
475 58 79

Go to line 65 of facets.js and replace the line with this:

const url = `${window.location.pathname}?section_id=${section.section}&${searchParams};`

theplanetsoft
Shopify Partner
1 0 0

Jump to Edit code and find the file "facets.js"

on like no 65 add code 

 

const url = `${window.location.pathname}?section_id=${section.section}&${searchParams}`;
 

 

 facets.png

 

manbru
Pathfinder
129 0 30

i added it like this:

Skärmavbild 2024-07-17 kl. 08.36.26.png

 

maybe it's wrong because it gave more errors:

Skärmavbild 2024-07-17 kl. 08.39.06.png

WalkYourStyle
Navigator
475 58 79

1. Go to 'Online Store' -> Theme -> Edit Code

2.  In the assets folder find the file 'facets.js'

3. Copy the below code

const url = `${window.location.pathname}?section_id=${section.section}&${searchParams}`;

4. Go to line 65, and replace the line which looks like this

const url = ${window.location.pathname}?section_id=${section.section}&${searchParams};

with the code you just copied.

5. After everything it should look like this:

sections.forEach((section) => {
  const url = `${window.location.pathname}?section_id=${section.section}&${searchParams}`;
  const filterDataUrl = (element) => element.url === url;

  FacetFiltersForm.filterData.some(filterDataUrl)
    ? FacetFiltersForm.renderSectionFromCache(filterDataUrl, event)
    : FacetFiltersForm.renderSectionFromFetch(url, event);
});