Product recommendations on but not showing - Capital theme

Topic summary

Product recommendations briefly appear on product pages, then disappear. The feature is enabled, so the issue is likely code-related rather than settings.

Key findings: malformed theme code is present. There’s a nested (invalid HTML/JS) used for a Facebook Pixel call and multiple tags, which can confuse the browser and break scripts. The recommendations’ code seems to be removed by JavaScript conflicts.

Suggested fixes:

  • In layouts/theme.liquid (near the opening ), remove the problematic Facebook Pixel snippet or at least delete the stray final tag.
  • Eliminate duplicate and tags.
  • Re-test after cleanup; if needed, explicitly add the recommendation section in product.liquid.
  • Review recent theme edits/app installs that could have introduced JS conflicts; revert those changes if identified.
  • As a fallback, consider restoring from a previous theme version (though the current owner prefers not to fully update an older copy).

Status: unresolved/ongoing. Next step is code cleanup and conflict isolation. Code snippets are central to the issue.

Summarized with AI on December 11. AI used: gpt-5.

Hi,

I have the product recommendations feature turned on, but it doesn’t seem to be showing. It will show for a second and then disappear; I assume something is wrong with the code. How can I fix this?

My website is: https://raidednz.com/

2 Likes

Do you have a previous copy of your theme?

Something crazy is going on in this one, like this – you can’t nest script and this way of calling Facebook pixel is wrong.

<script><script>
  fbq('track', 'AddToCart', {
    contents: [
        {
            quantity: 1
        }
    ],
  });
</script>;<script>

Besides – last <script> opens another Javascript element, but …

There are also 2 pairs of <body> and </body> tags.

These need to be sorted out – browser gets confused

I do, but it’s mad old and I can’t be bothered updating the entire thing again

@raidednz was it working before and stopped after you made an edit or update or added any app? the code been removed from the page which suggests it can happen due to javascript conflicts, do you remember any change to the site?

Ok, at least try to remove the last <script> in the snippet I’ve copied from your side.
Or remove it entirely, as it would not work properly anyway.

Should be in your layouts/theme.liquid, probably first thing after <body> tag.

I remember it did work at some point, but I’m unsure on what app, edit, or update could of disturbed it

You can try to add recommendation section in product.liquid file and check