Menu
predictiveSearch
Search-as-you-type results across products, collections, pages, articles and queries from a partial term.
Use it in a workflow
- Add a step and choose the Shopify Storefront connector.
- Pick the predictiveSearch action (under Predictive).
- Fill in the fields below, then reference the result from later steps as
{{predictivesearch.response.data}}.
Query
This is the query the action sends by default. Edit it in the step's Query field to change which fields come back.
query PredictiveSearch($limit: Int, $limitScope: PredictiveSearchLimitScope, $query: String!, $searchableFields: [SearchableField!], $types: [PredictiveSearchType!], $unavailableProducts: SearchUnavailableProductsType) {
predictiveSearch(
limit: $limit
limitScope: $limitScope
query: $query
searchableFields: $searchableFields
types: $types
unavailableProducts: $unavailableProducts
) {
articles {
author {
bio
email
firstName
lastName
name
}
authorV2 {
bio
email
firstName
lastName
name
}
blog {
authors
handle
id
onlineStoreUrl
seo
title
}
contentHtml
excerptHtml
handle
id
image {
altText
height
id
originalSrc
src
thumbhash
width
}
onlineStoreUrl
publishedAt
seo {
description
title
}
tags
title
trackingParameters
}
collections {
descriptionHtml
handle
id
image {
altText
height
id
originalSrc
src
thumbhash
width
}
onlineStoreUrl
seo {
description
title
}
title
trackingParameters
updatedAt
}
pages {
body
bodySummary
createdAt
handle
id
onlineStoreUrl
seo {
description
title
}
title
trackingParameters
updatedAt
}
products {
availableForSale
category {
ancestors
id
name
}
compareAtPriceRange {
maxVariantPrice
minVariantPrice
}
createdAt
descriptionHtml
encodedVariantAvailability
encodedVariantExistence
featuredImage {
altText
height
id
originalSrc
src
thumbhash
width
}
handle
id
isGiftCard
onlineStoreUrl
priceRange {
maxVariantPrice
minVariantPrice
}
productType
publishedAt
requiresSellingPlan
seo {
description
title
}
tags
title
totalInventory
trackingParameters
updatedAt
variantsCount {
count
precision
}
vendor
}
queries {
styledText
text
trackingParameters
}
}
}
Variables
Pass these as a JSON object in the step's Variables field.
{
"query": "string",
"limit": 0,
"limitScope": "ALL",
"searchableFields": [
"AUTHOR"
],
"types": [
"COLLECTION"
],
"unavailableProducts": "SHOW"
}
Response
Read the result with {{predictivesearch.response.data.data.predictiveSearch}}. If the API returns errors, the step fails and they are at {{predictivesearch.response.data.errors}}.
Need more? See the Shopify Storefront guide for connection setup and behaviour shared by every action.
Was this page helpful?