Why does the search bar on my Alchemy-themed website show incorrect product prices?

Developer G,

Thank you so much for trying to help me out. I really appreciate it.

I deleted all the apps and nothing changed.

I finally resolved the problem. The solution is actually way more complex than anticipated but I cant believe I figured it out lol…

I had to completely edit the javascript code and keep console logging until I debugged it.

Really cant believe the theme authors… nobody tried to help and they must know of the code!!

There are two things to note:-

  1. The prices coming out of the search box are coming from the javascript code and

  2. The prices of the product cards are coming from the Shopify liquid code and they are both different.

So once I fixed the search bar I had to fix the product card also as it was rounding up products too.

If you look at line 93-102 in the theme.js —> huge problems here its actually completely wrongly coded!

first thing I did was take out the t= (t/100).toFixed(r); as this will round up numbers.

I then created an if clause

t= String(t); (defined price here as a string)

if (t.includes(“.”) {

if(Number(t.split(“.”)

[1] === 0) {

return t.split(“.”)

[0];

}

else{

t=t.substring(0, t.length-2);

return t;

}

}

else {

reused the old code here

}

If you also look at line 111 in the theme.js → problem here too with o…

should be o= a(t, 2);

For a non developer… not bad for an autobot eh!