productSearch query

This article discusses the productSearch query that is available in the Live Search and Catalog Service extension. While similar in structure and functionality, there are differences in what they output.

See Boundaries and Limits in the Live Search Guide for the latest recommendations for creating performant queries.

Syntax

productSearch(
    phrase: String!
    context: QueryContextInput!
    current_page: Int = 1
    page_size: Int = 20
    sort: [ProductSearchSortInput!]
    filter: [SearchClauseInput!]
): ProductSearchResponse!

Construct a productSearch query

Live Search uses the productSearch query to search for products instead of the products query, which is provided with Adobe Commerce and Magento Open Source. Although the two queries are functionally similar, they have different input requirements. The products query returns information that is relevant for layered navigation, while the productSearch query returns faceting data and other features that are specific to Live Search.

data-variant=info
data-slots=text
The Catalog Service productSearch query uses Live Search to return details about the SKUs specified as input.

The productSearch query accepts the following fields as input:

data-variant=info
data-slots=text
The initial release does not allow for different merchandising strategies per customer group.

phrase

The phrase field contains the text that a shopper enters on the storefront. Live Search applies all configured rules, synonyms, and other configuration settings to determine the search results. All productSearch queries must contain the phrase field. If the query filters on a category or category path, the value of the phrase field can be an empty string.

The following example sets pants as the phrase to search for:

phrase: "pants"
data-variant=info
data-slots=text
Use the attributeMetadata query to return a list of product attributes that can be used to define a filter.

context

data-variant=info
data-slots=text
The context object is only applicable to Live Search.

The context object passes both the customer group code and user view history to the query. If no value is passed, the "Not Logged In" group is used.

context: {
 customerGroup: "b6589fc6ab0dc82cf12099d1c2d40ab994e8410c",
 userViewHistory: [
   {
     sku: "sku-01",
     dateTime: "2022-10-13T20:53:21.338Z"
   },
   {
     sku: "sku-02",
     dateTime: "2022-10-13T20:53:21.338Z"
   }
 ]
} 

current_page

The currentPage field specifies which page of results to return. If no value is specified, the first page is returned.

The system returns an error if you specify a value that is greater than the number of available pages.

The following example sets the current page to 5:

current_page: 5

page_size

When you run a query, you do not know in advance how many items the query will return. The query could return a few items, or it could return hundreds. The page_size field determines how many items to return at one time. If you use the default value of 20, and the query returns 97 items, the results are stored in four pages containing 20 items each, and one page containing 17 items.

The following example sets the page size to 10:

page_size: 10

sort

The sort field allows you to specify one or more product attributes to be used to sort the results. If you specify more than one attribute, Live Search sorts by the first field listed. If any items have the same value, those items are sorted by the secondary field. The value for each field can be set to either ASC or DESC.

The following example causes the query to filter first by price, and then by name:

sort: [
    {
      attribute: "price"
      direction: DESC
    }
    {
      attribute: "name"
      direction: DESC
    }
]

Filtering

The filter attribute is the part of the query that uses product attributes as facets or categories that are defined in the Admin. For example, to filter results by color, a color facet must be defined in Live Search, based on the existing color attribute.

Filtering by attributes

An attribute filter consists of a product attribute, a comparison operator, and the value that is being searched for. Together, they help narrow the search results, based on shopper input. For example:

If an attribute is numeric, you can filter on it as a price range, such as between $50 and $100. For example, to filter on a price range, set the attribute to price, and assign the range field with from and to values as 50 and 100, respectively. Products that are equal to the upper range are not included in the results. This aligns with how price ranges are defined for facets.

You can define multiple filters in the same call. The following example filters on the price and size:

filter: [
    {
      attribute: "price"
      range: {
        from: 50
        to: 100
      }
    },
    {
      attribute: "size"
      in: ["M", "L"]
    }
]

An attribute must be set to filterableInSearch: true if it is passed in as part of the filter. Otherwise, a "500 error" is returned.

Only facets specified in Live Search are returned.

data-variant=info
data-slots=text
Use the attributeMetadata query to return a list of product attributes that can be used to define a filter.

Layered search and expansion of search types

Layered search, or search within a search, is an attribute-based filtering system that extends the traditional search functionality to include additional search parameters. These additional search parameters allow more precise and flexible product discovery. See the merchant documentation to learn how to update the search types in the Admin to enable layered search.

data-variant=info
data-slots=text
Layered search is available in Live Search 4.6.0 (PaaS) or in the latest version of Commerce Optimizer (SaaS).

The advanced search capabilities are implemented through the filter parameter in the productSearch query using specific operators:

Examples

Learn how to implement these new search capabilities in your Live Search API by following the examples below. First, review the requirements to ensure proper configuration.

Frontend support:

Layered search is available on the following architectures:

data-variant=info
data-slots=text
The Live Search Product Listing Page (PLP) and popover widgets do not support layered search.

API configuration requirements:

Performance considerations:

Error handling:

startsWith condition example

The following example shows how you can search the "manufacturer" product attribute using a startsWith value of "Sieme".

filter: [  
  {  
    attribute: "manufacturer",  
    startsWith: "Sieme"  
  }  
]
contains condition example

The following example shows how you can search the "manufacturer" product attribute using a contains value of "auto". The result of this query would match manufacturers named "ABC Auto Company" and "ABCauto" for example.

filter: [  
  {  
    attribute: "manufacturer",  
    contains: "auto"  
  }  
]
endsWith filter example

To search an attribute value using endsWith, you must reverse the attribute value when you ingest the data. Then, you can use the startsWith condition on the specific attribute. In the following example, the part number is actually: PN-5763.

filter: [  
  {  
    attribute: "part_number_reverse",  
    startsWith: "3675-NP"  
  }  
]

The following example shows how to search within search results using "motor" as the search phrase and filtering on manufacturer that startsWith the term "Sieme":

productSearch(  
  phrase: "motor",  
    filter: [  
      {  
        attribute: "manufacturer",  
        startsWith: "Sieme"  
      }  
    ]  
)

The following example shows how to search within search results using "motor" as the search phrase and filtering on "part_number" that "startsWith" the term "PE-123":

productSearch(  
  phrase: "motor",  
    filter: [  
      {  
        attribute: "part_number",  
        startsWith: "PE-123"  
      }  
    ]  
)

The following example shows how to search within search results using "motor" as the search phrase and filtering on "manufacturer" that "endsWith" the term "PE-123":

productSearch(  
  phrase: "motor",  
    filter: [  
      {  
        attribute: "reverse_part_number",  
        startsWith: "321-EP"  
      }  
    ]  
)

The following example shows how to search within search results using "motor" as the search phrase and filtering on "description" that "contains" the phrase "warranty included":

productSearch(  
  phrase: "motor",  
    filter: [  
      {  
        attribute: "description",  
        contains: "warranty included"  
      }  
    ]  
)

The following example shows how to search a particular attribute for startsWith but not search within the search result:

productSearch(  
  phrase: "",  
    filter: [  
      {  
        attribute: "part_number",  
        startsWith: "PE-123"  
      }  
  ]  
)
Limitations

The advanced search capabilitiies have the following limitations:

For additional Live Search boundaries and limits, see boundaries and limits in the Live Search merchant guide.

Filtering by categories

Results can be filtered by categories defined in the Admin with the categories and categoryPath filters. They are slightly different in the type of facets returned:

categories is preferred when selecting from a category filter. Filtering on categories with "women/bottoms-women" and the phrase pants, the category facets returned are "promotions/pants-all", "women/bottoms-women/pants-women", and similar.

categoryPath is preferred when browsing by category. categoryPath returns the immediate subcategories of the category path being filtered. Filtering on categoryPath with "women/bottoms-women", the category facets returned are its children such as "women/bottoms-women/pants-women" and "women/bottoms-women/shorts-women".

A phrase attribute is required but it may be an empty string if you are filtering by category or categoryPath.

Pinned categories are always returned, regardless of the filtered category.

data-variant=info
data-slots=text
For search merchandising rules to apply correctly, the productSearch query should sort by relevance or pass no sort variables at all. For category merchandising rules to apply correctly, the productSearch query should sort by position, filter on categoryPath for browsing a category page (otherwise, no category rules will be applied), and phrase should be "empty".

categoryPath

This example shows how to filter returned facets when browsing a category page.

categoryPath performs strict filtering, meaning that the facets returned are limited to the immediate children of the current category page.

The following snippet corresponds to a shopper selecting Women > Bottoms.

filter:[
  {
    attribute:"categoryPath",
    eq: "women/bottoms-women"
    }
  ] 
Error handling for categories, categoryPath, and categoryIds

When sorting by category position with an empty or invalid categories, categoryPath, or categoryIDs, the Search service gracefully handles the request to prevent FAILED_PRECONDITION errors. This scenario commonly occurs when attempting to sort by position at the root category level, where category paths are not standardized across store views.

Behavior when an empty or invalid categories, categoryPath, or categoryIDs is detected with position sorting:

data-variant=info
data-slots=text
Despite the empty or invalid categories, categoryPath, or categoryIDs, the query executes successfully and returns product data in the data object, sorted by relevance instead of position.

Example query:

{
  productSearch(
    phrase: "pants"
    page_size: 8
    filter: [
      {
        attribute: "categoryPath",
        eq: null
      }
    ]
    sort: [
      {
        attribute: "position",
        direction: ASC
      }
    ]
  ) {
    items {
      productView {
        name
        sku
      }
    }
  }
}

In this example, the system returns products sorted by relevance.

categories

categories can be used as a filter in a query when a category facet is selected in the layered navigation. This does not result in strict filtering when used by itself.

filter: [
  {
    attribute:"categories", 
    in: "women/bottoms-women"
  },
  {
    attribute: "visibility",
    in: ["Catalog", "Catalog, Search"]
  },
]

Category filters can be used together. Here, the shopper navigates to "Womens -> Bottoms" and filters on "pants". This query returns both "Pants" and "Shorts" as facets in the layered navigation.

filter: [
  {
    attribute: "visibility",
    in: ["Catalog", "Catalog, Search"]
  },
  {
    attribute:"categoryPath",
    eq: ["women/bottoms-women"]
  },
  {
    attribute:"categories",
    in: ["women/bottoms-women/pants-women"]
  }
]

Define query output

The response to the productSearch query can contain details about each product returned and information about the ordering of the results.

Facets

Facets provide a method of high-performance filtering that uses multiple dimensions of attribute values as search criteria. Faceted search is similar, but considerably more advanced than the native layered navigation functionality.

The facets object contains details about each facet that affects the search results. By default, Live Search provides static facets for the categories and price product attributes that are pinned to the top of the Filters list in the storefront. The merchant can also pin other attributes to this list.

Dynamic facets appear only when relevant, and the selection changes according to the products returned. In the storefront Filters list, dynamic facets appear in alphabetic order after any pinned facets. To streamline search results, facets are set to dynamic by default.

Intelligent dynamic facets measure the frequency that an attribute appears in the results list and its prevalence throughout the catalog. Live Search uses this information to determine the order of returned products. This makes it possible to return two types of dynamic facets: Those that are most significant, followed by those that are most popular.

The buckets subobject divides the data into manageable groups. For the price and similar numeric attributes, each bucket defines a price range and counts the items within that price range. Meanwhile, the buckets associated with the categories attribute list details about each category a product is a member of. The contents of dynamic facet buckets vary.

The following snippet returns all information about the applicable facets for a search:

facets {
    attribute
    title
    type
    buckets {
        title
        ... on RangeBucket {
          title
          to
          from
          count
        }
        ... on ScalarBucket {
          title
          id
          count
        }
        ... on StatsBucket {
          title
          min
          max
        }
    }
}

Items list

The items object primarily provides details about each item returned. The structure of this object varies between Catalog Service and Live Search. For Catalog Service, specify a ProductSearchItem.productView object. For Live Search, specify a ProductSearchItem.product object

data-variant=info
data-slots=text
The ProductInterface object in the Search service GraphQL schema has been deprecated. Use the ProductView object instead, which is defined and documented as the recommended alternative for use with the Catalog Service.

ProductSearchItem.productView

data-variant=info
data-slots=text
Use the ProductView field instead of the deprecated product field to return product details. Catalog Service uses Catalog Sync to manage product data, resulting in query responses with less latency than is possible with the ProductInterface. With Catalog Service, the structure of the pricing information varies, depending on whether the product is designated as a SimpleProduct (simple, downloadable, gift card) or as a ComplexProduct (configurable, grouped, or bundle).

The following Catalog Service snippet returns relevant information about each item:

items {
  productView {
    name
    sku
    ... on SimpleProductView {
      price {
        final {
          amount {
            value
            currency
          }
        }
        regular {
          amount {
            value
            currency
          }
        }
      }
    }
    ... on ComplexProductView {
      options {
        id
        title
        required
        values {
          id
          title
        }
      }
      priceRange {
        maximum {
          final {
            amount {
              value
              currency
            }
          }
          regular {
            amount {
              value
              currency
            }
          }
        }
        minimum {
          final {
            amount {
              value
              currency
            }
          }
          regular {
            amount {
              value
              currency
            }
          }
        }
      }
    }
  }
}

The items object can also optionally return highlighted text that shows the matching search terms.

Other fields and objects

The query response can also contain the following top-level fields and objects:

Endpoints

data-src=../../../../includes/graphql/endpoints.md

Required headers

You must specify the following HTTP headers to run this query.

Header name
Description
Magento-Customer-Group
(Catalog Service Only) Specify the customer group code for the API request.
Magento-Environment-Id
This value is displayed at Stores > Configuration > Services > Magento Services > SaaS Environment or can be obtained by running the bin/magento config:show services_connector/services_id/environment_id command.
Magento-Store-Code
The code assigned to the store associated with the active store view. For example, main_website_store.
Magento-Store-View-Code
The code assigned to the active store view. For example, default.
Magento-Website-Code
The code assigned to the website associated with the active store view. For example, base.
X-Api-Key
Set this value to the unique API key generated for your Commerce environment.

Find the customer group code

data-src=../../../../includes/graphql/customer-group-code.md

Example usage

The following example uses the ProductView object to return item information. Note that the pricing information varies, depending on the product type. For the sake of brevity, facet information is not shown.

Request:

{
  productSearch(
    phrase: "bag"
    sort: [
      {
        attribute: "price"
        direction: DESC }]
    page_size: 9
  ) {
    page_info {
      current_page
      page_size
      total_pages
    }
    items {
      productView {
        name
        sku
        ... on SimpleProductView {
          price {
            final {
              amount {
                value
                currency
              }
            }
            regular {
              amount {
                value
                currency
              }
            }
          }
        }
        ... on ComplexProductView {
          options {
            id
            title
            required
            values {
              id
              title
            }
          }
          priceRange {
            maximum {
              final {
                amount {
                  value
                  currency
                }
              }
              regular {
                amount {
                  value
                  currency
                }
              }
            }
            minimum {
              final {
                amount {
                  value
                  currency
                }
              }
              regular {
                amount {
                  value
                  currency
                }
              }
            }
          }
        }
      }
    }
  }
}
data-slots=content
data-summary=Response
{
  "data": {
    "productSearch": {
      "page_info": {
        "current_page": 1,
        "page_size": 9,
        "total_pages": 3
      },
      "items": [
        {
          "productView": {
            "name": "Impulse Duffle",
            "sku": "24-UB02",
            "price": {
              "final": {
                "amount": {
                  "value": 74,
                  "currency": "USD"
                }
              },
              "regular": {
                "amount": {
                  "value": 74,
                  "currency": "USD"
                }
              }
            }
          }
        },
        {
          "productView": {
            "name": "Fusion Backpack 567890",
            "sku": "24-MB02",
            "price": {
              "final": {
                "amount": {
                  "value": 59,
                  "currency": "USD"
                }
              },
              "regular": {
                "amount": {
                  "value": 59,
                  "currency": "USD"
                }
              }
            }
          }
        },
        {
          "productView": {
            "name": "Rival Field Messenger",
            "sku": "24-MB06",
            "price": {
              "final": {
                "amount": {
                  "value": 45,
                  "currency": "USD"
                }
              },
              "regular": {
                "amount": {
                  "value": 45,
                  "currency": "USD"
                }
              }
            }
          }
        },
        {
          "productView": {
            "name": "Push It Messenger Bag",
            "sku": "24-WB04",
            "price": {
              "final": {
                "amount": {
                  "value": 45,
                  "currency": "USD"
                }
              },
              "regular": {
                "amount": {
                  "value": 45,
                  "currency": "USD"
                }
              }
            }
          }
        },
        {
          "productView": {
            "name": "Overnight Duffle",
            "sku": "24-WB07",
            "price": {
              "final": {
                "amount": {
                  "value": 45,
                  "currency": "USD"
                }
              },
              "regular": {
                "amount": {
                  "value": 45,
                  "currency": "USD"
                }
              }
            }
          }
        },
        {
          "productView": {
            "name": "Wayfarer Messenger Bag 987",
            "sku": "24-MB05",
            "price": {
              "final": {
                "amount": {
                  "value": 44,
                  "currency": "USD"
                }
              },
              "regular": {
                "amount": {
                  "value": 44,
                  "currency": "USD"
                }
              }
            }
          }
        },
        {
          "productView": {
            "name": "Driven Backpack",
            "sku": "24-WB03",
            "price": {
              "final": {
                "amount": {
                  "value": 36,
                  "currency": "USD"
                }
              },
              "regular": {
                "amount": {
                  "value": 36,
                  "currency": "USD"
                }
              }
            }
          }
        }
      ]
    }
  }
}

Input fields

The productSearch query accepts the following fields as input:

Field
Data Type
Description
context
[QueryContextInput!]
Query context that allows customized search results to be returned based on the context passed
current_page
Int
Specifies which page of results to return. Default value: 1
filter
[SearchClauseInput!]
Identifies which attributes to search for and return
page_size
Int
Specifies the maximum number of results to return at once. Default value: 20
phrase
String!
The text to filter on. Can be an empty string.
sort
[ProductSearchSortInput!]
Specifies which attribute to sort on, and whether to return the results in ascending or descending order

SearchClauseInput data type

The SearchClauseInput object can contain the following fields:

Field
Data Type
Description
attribute
String!
The attribute code of a product attribute
eq
String
A string value to filter on
in
[String]
An array of string values to filter on
range
SearchRangeInput
A range of numeric values to filter on
contains
String
A string that searches for products containing specific attribute values
startsWith
String
A string that searches for products where the attribute value starts with a particular string

SearchRangeInput data type

The SearchRangeInput object can contain the following fields:

Field
Data Type
Description
from
Float
The minimum value to filter on. If not specified, the value of 0 is applied
to
Float
The maximum value to filter on

ProductSearchSortInput data type

The ProductSearchSortInput object can contain the following fields.

Field
Data Type
Description
attribute
String!
The attribute code of a product attribute
direction
SortEnum!
ASC (ascending) or DESC (descending)

QueryContextInput data type

The QueryContextInput object can contain the following fields.

Field
Data Type
Description
customerGroup
String!
The customer group code. For storefront clients, this value is available in the dataservices_customer_group cookie.
userViewHistory
ViewHistoryInput!
List of SKUs with timestamps. Used in "Recommended for you" ranking.

ViewHistoryInput data type

The ViewHistoryInput object can contain the following fields.

Field
Data Type
Description
dateTime
String!
Timestamps when the SKU was viewed
sku
String!
The SKU of the view history being requested

Output fields

The productSearchResponse return object can contain the following fields:

Common fields

Field
Data Type
Description
facets
[Aggregation]
Provides details about the static and dynamic facets relevant to the search
items
[ProductSearchItem]
An array of products returned by the query
page_info
SearchResultPageInfo
Contains information for rendering pages of search results
related_terms
[String]
Reserved for future use
suggestions
[String]
An array of product URL keys that are similar to the search query. A maximum of five items are returned. See Logic used for suggestions to learn more.
total_count
Int
The total number of items returned

Logic used for suggestions

When a search is made, the "suggestion" field is searched using a "prefix" based search and the matching phrases are returned.

Example - If "sport" is searched, then "sport pant" will be one suggestion.

Aggregation data type

Field
Data Type
Description
attribute
String!
The attribute code of the filter item
buckets
[Bucket]!
A container that divides the data into manageable groups. For example, attributes that can have numeric values might have buckets that define price ranges
title
String!
The filter name displayed in layered navigation
type
AggregationType
Identifies the data type as one of the following: INTELLIGENT, PINNED, or POPULAR

Bucket data type

The Bucket object defines one field, title. However, the object has three implementations that can be used to provide greater detail.

Field
Data Type
Description
title
String!
A human-readable name of a bucket

RangeBucket implementation

Implement RangeBucket on numeric product fields.

Field
Data Type
Description
count
Int!
The number of items in the bucket
from
Float!
The minimum amount in a price range
title
String!
The display text defining the price range
to
Float
The maximum amount in a price range

ScalarBucket implementation

Implement ScalarBucket on string and other scalar product fields.

Field
Data Type
Description
count
Int!
The number of items in the bucket
id
ID!
An identifier that can be used for filtering and may contain non-human readable data
title
String!
The display text that defines the scalar value

StatsBucket implementation

Implement StatsBucket to retrieve statistics across multiple buckets.

Field
Data Type
Description
max
Float!
The maximum value
min
Float!
The minimum value
title
String!
The display text defining the bucket

ProductSearchItem data type

The ProductSearchItem data type can contain the following fields:

Field
Data Type
Description
appliedQueryRule
AppliedQueryRule
The query rule type that was applied to this product, if any (in preview mode only, returns null otherwise). Possible values: BOOST, BURY, and PIN

SearchResultPageInfo data type

The SearchResultPageInfo data type can contain the following fields:

Field
Data Type
Description
current_page
Int
Specifies which page of results to return
page_size
Int
Specifies the maximum number of items to return
total_pages
Int
Specifies the total number of pages returned

Live Search fields

data-variant=info
data-slots=text
By default, Live Search uses the ProductInterface to return product information. This interface is deprecated. Use the ProductView object, originally defined in Catalog Service, for better performance and future compatibility.

Catalog Service fields

The ProductView return object is an interface that can contain the following fields. It is implemented by the SimpleProductView and ComplexProductView types.

Field
Data Type
Description
addToCartAllowed
Boolean
Indicates whether the product can be added to the cart.
attributes(roles: [String])
[ProductViewAttribute]
A list of merchant-defined attributes designated for the storefront.
description
String
The detailed description of the product.
externalId
String
The external ID of the product.
id
ID!
The product ID, generated as a composite key, unique per locale.
images(roles: [String])
[ProductViewImage]
A list of images defined for the product.
inputOptions
[ProductViewInputOption]
A list of input options the shopper can supply to customize a product.
inStock
Boolean
Indicates whether the product is in stock.
lastModifiedAt
DateTime
Date and time when the product was last updated.
links(linkTypes: [String!])
[ProductViewLink]
A list of related, corss-sell, or up-sell products.
lowStock
Boolean
Indicates whether the product stock is low.
metaDescription
String
A brief overview of the product for search results listings.
metaKeyword
String
A comma-separated list of keywords that are visible only to search engines.
metaTitle
String
A string that is displayed in the title bar and tab of the browser and in search results lists.
name
String
Product name.
shortDescription
String
A summary of the product.
sku
String
Product SKU.
url
String
Canonical URL of the product.
urlKey
String
URL key of the product.

ComplexProductView type

The ComplexProductView type represents bundle, configurable, and group products. Complex product prices are returned as a price range, because price values can vary based on selected options. The type implements ProductView.

Field
Data Type
Description
addToCartAllowed
Boolean
Indicates whether the product can be added to the cart.
attributes(roles: [String])
[ProductViewAttribute]
A list of merchant-defined attributes designated for the storefront.
description
String
The detailed description of the product.
externalId
String
The external ID of the product.
id
ID!
The product ID, generated as a composite key, unique per locale.
images(roles: [String])
[ProductViewImage]
A list of images defined for the product.
inputOptions
[ProductViewInputOption]
A list of input options the shopper can supply to customize a product.
inStock
Boolean
Indicates whether the product is in stock.
links(linkTypes: [String!])
[ProductViewLink]
A list of product links.
lowStock
Boolean
Indicates whether the product stock is low.
metaDescription
String
A brief overview of the product for search results listings.
metaKeyword
String
A comma-separated list of keywords that are visible only to search engines.
metaTitle
String
A string that is displayed in the title bar and tab of the browser and in search results lists.
name
String
Product name.
options
[ProductViewOption]
A list of selectable options.
priceRange
ProductViewPriceRange
A range of possible prices for a complex product.
shortDescription
String
A summary of the product.
sku
String
Product SKU.
url
String
Canonical URL of the product.
urlKey
String
URL key of the product.
videos
[ProductViewVideo](#productviewvideo-type)
A list of videos linked to the product.

Price type

The Price type defines the price of a simple product or a part of a price range for a complex product. It can include a list of price adjustments.

Field
Data Type
Description
adjustments
[PriceAdjustment]
A list of price adjustments.
amount
ProductViewMoney
Contains the monetary value and currency code of a product.

PriceAdjustment type

The PriceAdjustment type specifies the amount and type of a price adjustment. An example code value is weee.

Field
Data Type
Description
amount
Float
The amount of the price adjustment.
code
String
Identifies the type of price adjustment.

ProductViewAttribute type

The ProductViewAttribute type is a container for customer-defined attributes that are displayed the storefront.

Field
Data Type
Description
label
String
Label of the attribute.
name
String!
Name of an attribute code.
roles
[String]
Roles designated for an attribute on the storefront, such as "Show on PLP", "Show in PDP", or "Show in Search".
value
JSON
Attribute value, arbitrary of type.

ProductViewImage type

The ProductViewImage type contains details about a product image.

Field
Data Type
Description
label
String
The display label of the product image.
roles
[String]
A list that describes how the image is used. Can be image, small_image, or thumbnail.
url
String!
The URL to the product image.

The ProductViewLink type contains details about product links for related products and cross selling.

Field
Data Type
Description
linkTypes
[String!]!
Types of links for this product. Can be crosssell, related, and upsell.
product
ProductView!
Details about the product in the link.

ProductViewMoney type

The ProductViewMoney type defines a monetary value, including a numeric value and a currency code.

Field
Data Type
Description
currency
ProductViewCurrency
A three-letter currency code, such as USD or EUR.
value
Float
A number expressing a monetary value.

ProductViewInputOption type

Product input options provide details about how a shopper can enter customization details for a product. For example, for product personalization the input options might provide the fields for the shopper to add an image or text for a monogram. The input option can include an associated markupAmount that is applied to the product price. For additional information, see Product settings - Customizable Options.

Field
Data Type
Description
fileExtensions
String
A comma separated list of accepted file types for the input option if it has an associated file, for example png, jpg.
id
ID
The ID of the option value.
imageSize
ProductViewInputOptionImageSize
Dimensions of an image associated with the input option.
markupAmount
Float
Amount to add or subtract from the product price when the option is configured.
range
ProductViewInputOptionRange
Value limits associated with an input option, for example allowed characters or file size.
required
Boolean
Indicates whether the option must be supplied.
sortOrder
Int
Indicates the order in which the option is displayed if multiple input options are configured.
suffix
String
SKU suffix added to the customized product.
title
String
The display name of the option value.
type
String
The type of control for entering the input option, for example textfield, textarea, date, date_time, time, file.

ProductViewInputOptionRange type

Lists the value range associated with a [ProductViewInputOption]. For example, if the input option is a text field, the range represents the number of characters.

Field
Data Type
Description
from
Float
Minimum value accepted for the option input.
to
Float
Maximum value accepted for the option input.

ProductViewInputOptionImageSize type

Lists the image dimensions for an image associated with a [ProductViewInputOption].

Field
Data Type
Description
height
Int
Height of image provided for an input option.
width
Int
Width of image provided for an input option.

ProductViewOption type

Product options provide a way to configure products by making selections of particular option values predefined for the product. Selecting one or many options points to a specific simple product.

Field
Data Type
Description
id
ID
The ID of the option.
multi
Boolean
Indicates whether the option allows multiple choices.
required
Boolean
Indicates whether the option must be selected.
title
String
The display name of the option.
values
[ProductViewOptionValue!]
List of available option values.

ProductViewOptionValue interface

The ProductViewOptionValue interface defines the product fields available to the ProductViewOptionValueProduct and ProductViewOptionValueConfiguration types.

Field
Data Type
Description
id
ID
The ID of an option value.
inStock
Boolean
Indicates if the option is in stock.
title
String
The display name of the option value.

ProductViewOptionValueConfiguration type

The ProductViewOptionValueConfiguration type is an implementation of ProductViewOptionValue for configuration values.

Field
Data Type
Description
id
ID
The ID of an option value.
inStock
Boolean
Indicates if the option is in stock.
title
String
The display name of the option value.

ProductViewOptionValueProduct type

The ProductViewOptionValueProduct type is an implementation of ProductViewOptionValue that adds details about a simple product.

Field
Data Type
Description
id
ID
The ID of an option value.
inStock
Boolean
Indicates if the option is in stock.
isDefault
Boolean
Indicates whether the option is the default.
product
SimpleProductView
Details about a simple product.
quantity
SimpleProductView
Default quantity of an option value.
title
String
The display name of the option value.

ProductViewOptionValueSwatch type

The ProductViewOptionValueSwatch type is an implementation of ProductViewOptionValue that adds details about a product swatch.

Field
Data Type
Description
id
ID
The ID of an option value.
inStock
Boolean
Indicates if the option is in stock.
title
String
The display name of the option value.
type
SwatchType
Indicates the type of swatch. Can be TEXT, IMAGE, COLOR_HEX, or CUSTOM.
value
String
The value of the swatch.

ProductViewPrice type

The ProductViewPrice type provides the base product price view, inherent for simple products.

Field
Data Type
Description
final
Price
Price value after discounts, excluding personalized promotions.
regular
Price
Base product price specified by the merchant.
roles
[String]
Determines if the price should be visible or hidden.

ProductViewPriceRange type

The ProductViewPriceRange type lists the minimum and maximum price of a complex product.

Field
Data Type
Description
maximum
ProductViewPrice
Maximum price.
minimum
ProductViewPrice
Minimum price.

ProductViewVideo type

Field
Data Type
Description
url
String
The URL to link to the product video.
description
String
Description of the product video.
title
String
Title of the product video.

SimpleProductView type

The SimpleProductView type represents all product types, except bundle, configurable, and group. Simple product prices do not contain price ranges. SimpleProductView implements ProductView.

Field
Data Type
Description
addToCartAllowed
Boolean
Indicates whether the product can be added to the cart.
attributes(roles: [String])
[ProductViewAttribute]
A list of merchant-defined attributes designated for the storefront.
description
String
The detailed description of the product.
externalId
String
The external ID of the product.
id
ID!
The product ID, generated as a composite key, unique per locale.
images(roles: [String])
[ProductViewImage]
A list of images defined for the product.
inputOptions
[ProductViewInputOption]
A list of input options the shopper can supply to customize a product.
inStock
Boolean
Indicates whether the product is in stock.
links(linkTypes: [String!])
[ProductViewLink]
A list of product links.
lowStock
Boolean
Indicates whether the product stock is low.
metaDescription
String
A brief overview of the product for search results listings.
metaKeyword
String
A comma-separated list of keywords that are visible only to search engines.
metaTitle
String
A string that is displayed in the title bar and tab of the browser and in search results lists.
name
String
Product name.
price
ProductViewPrice
Base product price view.
shortDescription
String
A summary of the product.
sku
String
Product SKU.
url
String
Canonical URL of the product.
urlKey
String
URL key of the product.