Discount Ninja
  • Discount Ninja Developer Hub
    • Storefront API
      • Promotion Engine
        • Enable
        • JavaScript API
          • Functions
          • Events
          • Objects
        • Error Messages
      • Widgets
        • Guiding principles
          • Accessibility
          • Localization
          • Integration
          • Style
        • Announcement Bar
        • Notification
        • Offer Rules Popup
        • Product Banner
        • Promotion Summary
        • Promotion Code Field
        • Promotional Badge
    • Integration
    • Theme edits
      • App blocks
        • Product Page Banner
        • Promo Code Field
        • Promotion Summary
      • Code edits
        • Product Detail Page (PDP)
          • Price
          • Banner
          • Badge
        • Product List Page (PLP) and Collections
          • Attributes
          • Price
            • Searchanise Search & Filter
            • Globo Smart Product Filter & Search (aka SPF)
            • AI Search & Product Filter (Ultimate Search)
            • Boost AI Search & Filter (aka PFS)
          • Badge
          • Pagination
          • Quick View
        • Cart
          • Root
          • Cart item
          • Promo Code Field
          • Promotion Summary
          • Subtotal
        • Gift With Purchase
Powered by GitBook
On this page
  • Snippet
  • Alternative, using Loaded event

Was this helpful?

  1. Discount Ninja Developer Hub
  2. Theme edits
  3. Code edits
  4. Product List Page (PLP) and Collections
  5. Price

Searchanise Search & Filter

Snippet

Add the following snippet inside the body element in the theme.liquid.

<script>
    document.addEventListener('Searchanise.AutocompleteUpdated', function() {
        document.dispatchEvent(new CustomEvent('la:dn:collection:updated'));
    });
    
    document.addEventListener('Searchanise.ResultsUpdated', function() {
        document.dispatchEvent(new CustomEvent('la:dn:collection:updated'));
    });
</script>

Alternative, using Loaded event

If the above does not work for you, uou may need to wrap this into the Searchanise.Loaded event. To do this use the following snippet:

<script>
  document.addEventListener('Searchanise.Loaded', function() {
    (function($) {
      $(document).on('Searchanise.AutocompleteUpdated', function(event, input, container) {
        document.dispatchEvent(new CustomEvent('la:dn:collection:updated'));
      });
       $(document).on('Searchanise.ResultsUpdated', function(event, input, container) {
        document.dispatchEvent(new CustomEvent('la:dn:collection:updated'));
      });
    })(window.Searchanise.$);
  });
</script>
PreviousPriceNextGlobo Smart Product Filter & Search (aka SPF)

Last updated 6 months ago

Was this helpful?