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

Topic summary

Issue: Live search showed inflated prices (e.g., 166 JD appeared as 1,660 JD). Product cards also rounded prices incorrectly.

Key investigation steps:

  • Theme placeholder HTML wasn’t the cause; pricing came from JavaScript (AJAX) in theme.js, while product cards used Liquid.
  • Fresh theme worked on a demo store (USD), suggesting a store-specific factor; suspected currency handling. Changing image size suffix (_100x) only affected thumbnails.
  • App conflict was considered; uninstalling all apps did not resolve it.

Resolution (by OP):

  • Edited theme.js price formatting logic.
    • Removed t = (t/100).toFixed(r) to prevent unintended rounding/cent conversion.
    • Treated the price as a string and conditionally trimmed the last two digits when appropriate; corrected another line to o = a(t, 2).
  • Applied a similar fix to product card pricing logic (Liquid vs JS paths were different).

Outcome:

  • Prices now display correctly in both the search bar and product cards.
  • No changes needed from theme authors or apps; issue was in theme.js logic.

Status: Resolved; no open questions. A screenshot was shared but not essential to the fix.

Summarized with AI on January 1. AI used: gpt-5.

Hi Developer-G,

I agree with you. Need to fix the route problem. Look at what I found in the theme.js file:

theme.announcementHeight = 0;
theme.HeaderSection = new function () {
this.onSectionLoad = function (target) {
// Search
if (theme.settings.enable_search) {
var $searchWrapper = $(‘.header-search__results-wrapper’);
var $searchContainer = $(‘.header-search__content’, target);
var $searchResultsContainer = $(‘.header-search__results’, target);
var currentReq = null;
var searchThrottleDelay = 400;
var searchThrottleTimeoutId = -1;
var imageReplaceRegex = {
search: /(.[^.]+)$/,
replace: ‘_100x$1’ };

var removeResultsAndPrepForMore = function removeResultsAndPrepForMore() {
var $oldResults = $searchResultsContainer.addClass(‘header-search__results–disband’);
setTimeout(function () {
$oldResults.remove();
}, 500);
$searchResultsContainer = $(‘

’).insertAfter($searchResultsContainer);
};
$(‘.header-search .input-with-button__input’, target).on(‘change.themeHeaderSection keyup.themeHeaderSection paste.themeHeaderSection’, function (e) {
var $input = $(this),
$form = $(this).closest(‘form’),
includeMeta = $searchWrapper.data(‘live-search-meta’);

// Has value changed?
if ($input.val() == $input.data(‘previous-value’)) {
return;
}

Could this be the cause? The replace: ‘_100x$1’ ]; ???

My knowledge with js is not great.

So after reverse engineering I changed it to 10x$1 but what happened is the photo of the product in the search box got smaller.

I guess thats not it…