What this section controls
This section controls search autocomplete with the following capabilities:- Real-time AJAX-powered search suggestions
- Multiple content type results (queries, products, pages, articles, collections)
- Instant results display without page reload
- Smart result limits for relevant suggestions
- Minimum character trigger (typically 2 characters)
- Keyboard navigation support
- Debounced API calls for performance
- No Theme Customizer settings (controlled by Shopify API)
This is a dynamic AJAX-powered component with no theme customizer settings. All functionality is controlled by Shopify’s Predictive Search API and the theme’s JavaScript code.
Key Features
Instant Results
Real-time suggestions appear as customers type
Multiple Content Types
Shows queries, products, pages, articles, and collections
Smart Limits
Displays most relevant results without overwhelming users
No Page Reload
AJAX-powered for seamless, fast search experience
How It Works
Search Activation
Search Activation
Trigger Conditions:
- Customer types in header search input field
- Typically requires minimum 2 characters
- Updates automatically as typing continues
- Debounced to prevent excessive API calls
- Appears as dropdown below search input
- Organized layout with clear section headings
- Responsive design (adapts to mobile/desktop)
- Smooth show/hide animations
- Click any result to navigate directly
- Bottom button shows full search page
- Escape key or clicking outside closes dropdown
- Keyboard navigation supported (arrow keys, enter)
Result Types & Limits
Result Types & Limits
The component searches across multiple content types and displays results in priority order:Queries (Limit: 3)
- Popular search terms matching the input
- Highlighted matching text (styled)
- Links to full search results for that term
- Example: Customer types “red” → suggests “red shoes”, “red dress”
- Collections matching search term
- Collection title displayed
- Links directly to collection page
- Informational pages (About, FAQ, etc.)
- Policy pages (Shipping, Returns, etc.)
- Custom content pages
- Blog posts matching search term
- Article titles displayed
- Links to full article
- Full product cards with images
- Product title and price
- Uses theme’s standard product card component
- Respects card product layout settings
- Hidden actions (no quick add or cart buttons)
Total results displayed: Up to 18 items (3 queries + 3 collections + 3 pages + 3 articles + 6 products). This prevents overwhelming users while providing comprehensive results.
Layout Structure
Layout Structure
Results are organized into clearly labeled sections:Queries Section
- Heading: “Suggestions” (translatable)
- List of suggested search terms
- Highlighted matching text
- Links to search results pages
- Heading: “Pages” (translatable)
- Combined list of pages and articles
- Title links only (no thumbnails)
- Heading: “Products” (translatable)
- Grid layout for product cards
- Column gap uses theme’s spacing settings
- 2-3 columns depending on viewport size
- Text: “Search for [terms]” (translatable)
- Always appears at bottom when results exist
- Submits search form to show full results page
Empty State
Empty State
When no results are found for the search query:Display:
- Message: “No results for [search term]” (translatable)
- Checks all resource types before showing empty state
- No “View all” button displayed
- No products found
- No pages found
- No articles found
- No collections found
- No query suggestions available
Technical Details
AJAX Implementation
AJAX Implementation
API Integration:
- Uses Shopify’s Predictive Search API
- Sends search query asynchronously
- Returns JSON response with results
- Renders HTML dynamically via Liquid template
- Debounced input (reduces API calls while typing)
- Only queries after minimum character count
- Cancels previous requests if new search starts
- Lightweight HTML response for fast rendering
- Customers must have JavaScript enabled
- Component will not function without JS
- Graceful degradation: regular search still works
Product Card Integration
Product Card Integration
The component renders products using the theme’s standard product card snippet:Parameters:
hide_actions: true- Removes quick add/cart buttonstitle_small: true- Uses smaller title sizecard_product_layout- Inherits from theme settings
Spacing & Styling
Spacing & Styling
Grid Spacing:The product grid respects theme-wide spacing settings for consistency.Custom Classes:
.predictive-search__results- Main container.predictive-search__row- Each result section.predictive-search__title- Section headings.predictive-search__links- Query/page/article lists.predictive-search__grid- Product grid container.predictive-search__link- View all button
Search Scope
Search Scope
Searchable Resources:
- All published products
- Published collections
- Published pages
- Published blog articles
- Product metafields (if configured)
- Product variants
- Draft products or pages
- Password-protected products
- Products from unpublished sales channels
- Private collections
- Customer data
- Product titles
- Product descriptions
- Product vendor
- Product tags
- Collection titles
- Page titles and content
- Article titles and content
Localization & Translation
All text strings are translatable via theme language files. Key translation keys:Translation Keys
Translation Keys
| Locale Key | Default Text | Usage |
|---|---|---|
search.queries_title | Suggestions | Queries section heading |
search.pages_title | Pages | Pages & articles heading |
search.products_title | Products | Products section heading |
search.empty_with_terms | No results for "" | Empty state message |
search.search_for | Search for "" | View all button text |
Browser Compatibility
JavaScript Required
Component requires JavaScript enabled - falls back to standard search if disabled
Modern Browsers
Supports all modern browsers (Chrome, Firefox, Safari, Edge)
Mobile Responsive
Fully responsive design adapts to all screen sizes
Keyboard Accessible
Supports keyboard navigation (arrow keys, enter, escape)
Best practices
Search optimization
Use descriptive, keyword-rich product titles and add comprehensive product descriptions. Tag products with relevant terms customers use when searching. Organize products into logical collections and keep page and article titles clear and searchable for better discovery.
Performance
Optimize product images for fast loading in search results. Keep product titles concise but descriptive. Limit the number of product variants when possible and ensure server response times are fast for instant predictive results.
User experience
Test search with common terms customers actually use. Monitor search analytics to improve product discoverability. Add popular search terms to product tags, keep collection names intuitive, and use clear page titles that match customer intent.
Content quality
Ensure all product titles, descriptions, and tags are complete and accurate. Use consistent terminology across products. Avoid duplicate content and maintain up-to-date information for all searchable content types.
Testing strategy
Regularly test search functionality with various query types. Check that results are relevant and display correctly. Verify mobile search experience and ensure quick result loading times across all devices.
Technical limitations
Understand that result limits, content types, and layout structure cannot be customized via theme settings. Modifications require code changes. Predictive search requires JavaScript and has no fallback autocomplete. Plan accordingly for your store’s needs.
Common Questions
Why don't some products appear in results?
Why don't some products appear in results?
Products may not appear if:
- They are in draft status (not published)
- They are excluded from specific sales channels
- They are password-protected
- Inventory is zero and “Continue selling when out of stock” is disabled
- They don’t match the search query closely enough
Can I customize the number of results?
Can I customize the number of results?
Not via theme settings. The limits are hardcoded:
- Queries: 3
- Collections: 3
- Pages: 3
- Articles: 3
- Products: 6
predictive-search.liquid file and modify the limit: parameters in the Liquid code.Can I change the order of sections?
Can I change the order of sections?
Yes, but requires code editing. The section order is determined by the HTML structure in
predictive-search.liquid. You can rearrange the {% if %} blocks to change display order.Default order: Queries → Pages/Articles → Products → View All ButtonHow do I disable predictive search?
How do I disable predictive search?
Predictive Search has no disable toggle in theme settings. Options:
- Remove JavaScript that triggers predictive search (advanced)
- Hide with CSS:
.predictive-search { display: none !important; }(visual hide only) - Remove component from header code (not recommended)
Does it search product metafields?
Does it search product metafields?
Yes, if metafields are configured as searchable in Shopify admin. Go to Settings → Custom Data → Products and enable “Storefront search” for specific metafields.This allows searching by custom attributes like:
- SKU numbers
- Material types
- Product specifications
- Custom identifiers
Related Sections & Components
- Header: Contains the search input that triggers predictive search
- Main Search: Full search results page for complete search experience
- Card Product Snippet: Product card component used in search results
- Shopify Predictive Search API: Backend API powering the search functionality