Compatibility and behavior of saved searches, segments, and discounts
Segments aren't backwards-compatible or connected to saved searches. For example, if a merchant creates or updates new segments, and you haven’t migrated your app to use segments instead of saved searches, then your app won't synchronize the changes that the merchant is making to segments.
Behavior of apps that aren't migrated
Anchor link to section titled "Behavior of apps that aren't migrated"In API versions older than 2022-04
, you can continue to create, update, and delete saved searches using the deprecated elements. If a customer saved search is compatible, then Shopify converts saved searches in the backend to segments. You can verify whether a saved search was successfully translated to a segment by querying the SegmentMigration
object.
When a merchant or app updates or deletes a saved search, Shopify attempts to translate the saved search to a segment in the following ways:
Event | What happens |
---|---|
The saved search is updated and can be converted to a segment. |
|
The saved search is updated but can't be converted to a segment. |
|
The saved search is deleted. Only the grouping of members (customers) is deleted. Customer data is preserved. |
|
The saved search is updated or deleted. When a segment is updated or deleted, it will sync its associated saved search. |
|
Validation behavior of saved searches
Anchor link to section titled "Validation behavior of saved searches"API request that involve price rules, discount codes, and saved searches are validated. Validations are introduced as part of the migration from using saved searches to segments. Validations either allow API requests, or block API requests, returning an error. Unmigratable saved searches are blocked.
Validation occurs under the following conditions:
- Price rules or discount codes are created or updated.
- A saved search that's used in a price rule or a discount code is updated.
Unmigratable saved searches
Anchor link to section titled "Unmigratable saved searches"The following types of saved searches are unmigratable if they create or update price rules or discount codes:
- Free text
- Saved searches that contain more than five filters
Unmigratable saved searches are blocked by the API validation and return an error. If an API request is blocked, then the price rule or discount code isn't affected.
If a saved search is updated, causing it to match the unmigratable saved search criteria, and that saved searched is referenced by a price rule or a discount code, then the API request is blocked, and an error message is returned.
The following mutations are blocked if they use unmigratable saved searches: