# Shopify Autocomplete

The **Autocomplete** page configures **Dynamic Autocomplete**, which enhances the Shopify theme's search bar with instant keyword predictions, product previews, brand and content links, exact SKU navigation, and predefined suggestions before shoppers begin typing.

<br/>

## Enabling Dynamic Autocomplete

1. In Shopify admin, open **Online Store > Themes** and select **Customize** on the active theme.
2. Open **App Embeds** (the puzzle-piece icon), enable **Dynamic Autocomplete**, and select **Save**.
3. In the Retail Cloud Connect Shopify App, open **Autocomplete** to choose which surfaces appear: keywords, products, brands, collections, pages, articles, and predefined suggestions.

Most stores require no theme code edits: once the App Embed is enabled, Dynamic Autocomplete locates the theme's search box automatically.

Stores previously using **Keyword Autocomplete** should disable its App Embed when enabling Dynamic Autocomplete so the two experiences do not compete for the same search input.

<br/>

## Edit Autocomplete Settings in a Profile

The page header's **Editing Production** or **Editing _profile name_** pill controls which profile is being edited. Layout, AI prediction, and predefined suggestion changes share one page-level **Save** and **Discard** action.

Named profiles can be tested on the **Dynamic Autocomplete** App Embed in Shopify's Theme Editor without changing Production. See [Storefront Settings Profiles](./theme-installation/storefront-settings-profiles.md) for creating, comparing, and promoting profiles, and [Product Card Builder](./product-card-builder/index.md#choose-a-storefront-surface) to customize the **Autocomplete** product card layout.

<br/>

## How It Takes Over the Search Bar

Dynamic Autocomplete attaches to the search inputs already present in the theme:

- **Standard search inputs attach automatically.** Shopify themes submit search with an input named `q`, so Dynamic Autocomplete attaches to `input[name="q"]` by default. When a shopper taps or focuses that input, the default Dynamic Autocomplete dialog opens with its own search field.
- **The theme's search field can stay primary.** Select **Keep theme search field** under **Search Field** to keep shoppers typing in the visible theme input and show results below it. While there is room for suggestions, this optional mode has no duplicate search field, modal focus trap, or page scroll lock. If the field moves outside the visible viewport or the mobile keyboard leaves too little room below it, autocomplete switches to its dialog and preserves the query. Disable the theme's own suggestion panel to avoid competing results. Search icons, other button triggers, and fields inside a theme dialog still open the autocomplete dialog with its own field. Existing stores retain the default dialog until this setting is changed.
- **Search inputs rendered after load are detected.** Many themes only render their search field inside a drawer or popup after the shopper taps a search icon. Dynamic Autocomplete watches the page for search inputs that are added or replaced after load and attaches to them immediately.
- **Custom themes can add selectors.** If a theme uses a search input without `name="q"`, add up to ten CSS selectors (one per line) in **Trigger Selectors** under **Layout & Behavior**. Matching inputs open the dialog on focus when **Open on Focus** is enabled (the default), and non-input elements such as a search icon open it on click.
- **Any element can become a search button.** Add `aria-controls="rcc-dynamic-autocomplete"` and `aria-haspopup="dialog"` to a button, link, or icon in the theme, or use `on:click="#rcc-dynamic/showDialog"` in Shopify theme markup. Either option opens Dynamic Autocomplete without selector configuration, prevents the element's default action, stops click propagation so the theme's search drawer does not also open, and restores focus when the dialog closes. Use [Dynamic Autocomplete events](./developer-customization/app-block-events.md#dynamic-autocomplete-events) to track opens, closes, and search submissions.
- **Individual inputs can opt out.** Add `data-rcc-autocomplete="off"` to a specific search input to keep the theme's native behavior there, such as a blog-only sidebar search.

Shoppers can also press `/` anywhere on the page (outside another text field) to open Dynamic Autocomplete focused and ready for typing.

### Troubleshooting the Search Trigger

{.compact}
| Symptom | Likely cause and fix |
| --- | --- |
| The theme's own suggestions still appear | The **Dynamic Autocomplete** App Embed is off, or the input has `data-rcc-autocomplete="off"`. |
| Nothing happens on the header search | The input is not named `q`. Inspect it and add its CSS selector to **Trigger Selectors**. |
| Works on desktop, not in the mobile search drawer | The drawer input uses a different selector than the desktop input. Add both selectors, one per line. |
| A specific search box should stay native | Add `data-rcc-autocomplete="off"` to that input. |

<br/>

## Layout & Behavior

{.compact}
| Setting | Behavior |
| --- | --- |
| Search Field | **Autocomplete search field (default)** opens the autocomplete dialog. **Keep theme search field** shows results below the visible theme input. |
| Position | Displays the dialog in the center of the screen (**Floating in Center of Screen**) or full width at the top. With **Keep theme search field**, results sit below the input: centered mode limits their width, while full-width mode spans the viewport. Button triggers retain the selected dialog position. |
| Product Display | Chooses **Responsive (default)**, **Grid**, or **Slider** for searched, recommended, and default product sections in either dialog position. |
| Trigger Selectors | Sets which storefront search inputs or controls open Dynamic Autocomplete. Defaults to `input[name="q"]`; enter one valid CSS selector per line to replace it. |
| Open on Focus | Opens suggestions when shoppers focus or tap a matching search input. Enabled by default. |
| Minimum Query Length | Sets how many characters a shopper must enter before AI Predictions start returning results. |
| Keyword Debounce (ms) | Delays keyword and lightweight Shopify suggestion requests while shoppers type. |
| Product Debounce (ms) | Delays billable AI Commerce Search product requests while shoppers type. |

The debounce controls are collapsed under **Advanced Settings** on the page; their saved values continue to apply while hidden. For visual restyling with `.rcc-dynamic` CSS variables, see [Styling App Blocks](./developer-customization/customizing-app-blocks.md#customizing-dynamic-autocomplete).

<br/>

## AI Predictions

### Keywords

{.compact}
| Setting | Behavior |
| --- | --- |
| Keyword Suggestions | Shows AI Commerce Search predictions for common text, brand, and collection searches. |
| Keyword Suggestion Limit | Limits the number of keyword predictions. |
| Shopify Fallback | Shows Shopify query suggestions when AI Commerce Search returns no text suggestions. |
| Fallback Query Limit | Limits the number of Shopify fallback suggestions. |

Keyword Autocomplete and Dynamic Autocomplete can also include queries from enabled Retail Cloud Connect redirect rules and active Google Cloud redirect controls. They appear before other predictions, are deduplicated, and count toward the configured suggestion limit (at most two redirect terms; up to six suggestions overall in Dynamic Autocomplete, or up to eight in Keyword Autocomplete). Automatically generated brand and sale redirects are excluded.

Redirect suggestions match exact text first, then prefixes, and only fall back to single-edit typo matching after at least three characters. Selecting the suggested phrase opens the redirect destination, while pressing Enter on an uncorrected misspelling still runs a normal search. See [Search Redirects](./search-redirects.md#storefront-behavior) for full redirect rules.

### Products

{.compact}
| Setting | Behavior |
| --- | --- |
| Product Suggestions | Shows initial product results from AI Commerce Search while shoppers type. Each request is billable. |
| Product Suggestion Limit | Limits the product grid up to eight cards (rendered in two columns and up to four rows on mobile). |
| Exact SKU Result | Shows a direct product result when Shopify finds an exact SKU match, replacing the product grid; pressing Enter opens the matched variant. |
| SKU Minimum Length | Sets the minimum number of characters checked for an exact SKU. |

### Additional Suggestions

{.compact}
| Setting | Behavior |
| --- | --- |
| Brand Suggestions | Shows matching Shopify product vendors alongside keyword suggestions. |
| Group Suggestions by Type | Separates query suggestions from direct collection, page, article, brand, and SKU destinations. Disable it to show one combined list. |
| Collection Suggestions | Shows matching Shopify collections as direct navigation results. |
| Page Suggestions | Shows matching Shopify pages as direct navigation results. |
| Article Suggestions | Shows matching Shopify blog articles as direct navigation results. Disabled by default. |
| Collections, Pages and Articles Limit | Limits the combined collection, page, and article results. |

Each AI Predictions source can be enabled independently. Product searches run separately from faster keyword, brand, collection, page, article, and SKU lookups so lightweight suggestions appear first. Article suggestions use Shopify content search in the shopper's active language and country.

<br/>

## Predefined Suggestions

Predefined Suggestions appear when Dynamic Autocomplete opens before a shopper begins typing.

### Default Products

{.compact}
| Setting | Behavior |
| --- | --- |
| Default Products | Shows bestsellers or products from a selected collection (up to six products). |
| Product Source | Selects **Bestsellers** or **Collection**. |
| Collection | Searches the store's Shopify collections when **Collection** is selected. |
| Default Product Limit | Limits the number of default product cards. |

Products from a selected collection retain Shopify's collection order, and the storefront heading uses the collection title translated for the shopper's active language when available.

### Personalized Products

{.compact}
| Setting | Behavior |
| --- | --- |
| Recommendations AI | Shows personalized products from a compatible Recommendations AI serving configuration. |
| Serving Configuration | Selects an available configuration from the connected Google Cloud project. |
| Personalized Product Limit | Limits the number of personalized product cards (up to six). |

The dropdown includes configurations backed by **Recommended for you**, **Buy it again**, **On sale**, and **Recently Viewed** models, and excludes AI Commerce Search configurations, models requiring an anchor product, and Page-level Optimization. See [Recommendations AI](../google-cloud-vertex-ai-search-for-commerce/recommendations-ai.md) for model details.

### Recent Searches

{.compact}
| Setting | Behavior |
| --- | --- |
| Recent Searches | Shows shoppers their recent successful searches for the current store and locale. |
| Recent Searches Limit | Limits the number of recent searches. |

Shoppers can clear their recent searches directly from the Dynamic Autocomplete dialog.

### Sample Queries

{.compact}
| Setting | Behavior |
| --- | --- |
| Sample Queries | Shows curated suggestions before shoppers type. |
| Sample Query 1–5 | Sets up to five merchant-defined example queries. |

Sample queries can be localized for secondary languages on the [Translations](./translations.md) page.

<br/>

## Keyword Autocomplete (Legacy)

Stores that only want a lightweight text-suggestion dropdown can enable the legacy **Keyword Autocomplete** App Embed instead of **Dynamic Autocomplete**. Its **Enable Shopify Fallback** setting uses existing Shopify search suggestions while AI Commerce Search trains on storefront traffic (typically a few days to begin learning and one to two weeks to mature on active stores). Do not enable both autocomplete App Embeds at the same time.
