Smart collection migration guide

Shopify currently requires that products within smart collections be sorted either manually or automatically. Manual sorting means that all products are sorted manually into the required display order. Automatic sorting enables products to be sorted automatically (for example, alphabetically or chronologically).

Beginning in 2019, it will be possible to sort some products manually within smart collections. This lets you set a smart collection to any automatic sort order, and then specify a subset of products to be sorted manually. Any products that aren't manually sorted will be automatically sorted according to a specified automatic sort order. You will be given approximately one month's notice to update your apps before this feature is enabled on any shops that will be impacted by these changes.

To learn more about how sorting works with this new feature, see Sorting automated collections.

Upcoming changes to the SmartCollection resource

If you're using the SmartCollection resource, then you've been able to change the order of products in smart collections whose sort_order is set to manual. After the upcoming changes to the SmartCollection resource, you'll be able to set products for manual sort for all smart collections, no matter what automatic sort order has been specified.

Payload changes

The upcoming changes to the SmartCollection resource will result in the following payload changes.

Setting products to be sorted manually

The manual setting of the sort_order property will be deprecated in 2019. At that time, you won't be able to set smart collections to be sorted manually. Instead, you'll need to specify manually-sorted products to include in smart collections that are otherwise sorted automatically.

For example, the following PUT request to the smart_collections/order endpoint sets the smart collection to sort by best selling, and then specifies three product IDs to be sorted manually:

PUT /admin/smart_collections/#{smart_collection_id}/order.json?sort_order=best-selling&products[]=12170011974,12170011975,12170011981

In the Shopify admin, the collection identifies the products that are sorted manually and the products that are sorted automatically:

Manually sorted products

Changing products from manual to automatic sorting

Currently, you can change a product from being sorted manually to being sorted automatically by updating the sort_order property. As of mid-October, this will no longer be the case. At that time, you'll need to send an empty products array as part of a call to the /orders endpoint to prevent products from being sorted manually.

PUT /admin/smart_collections/67942613048/order.json?products=[]

Response

{

}

Obtaining a count of manually sorted products on a smart collection

With the upcoming changes to the SmartCollection resource, you'll be able to obtain a count of manually sorted products in a smart collection using the products_manually_sorted_count property. The read-only property allows you to obtain the count directly from the SmartCollection resource.

Deprecation schedule

In 2019, the feature will be released progressively across Shopify stores. At that time, you'll also be able to enable the feature on development stores for testing purposes. You will be given approximately one month's notice to update your apps before this feature is enabled on any shops that will be impacted by these changes.

For more information, contact Shopify from your Partner Dashboard.

The smart_collection/products endpoint

With the upcoming changes to the SmartCollection resource, you'll want to know how each product in the collection is set to be sorted. You'll be able to use the smart_collection/products endpoint to filter results by products that are sorted manually or by products that are sorted automatically. You'll also be able to use this endpoint to return the position of products within a smart collection.

Payload examples

The smart_collection/products endpoint will be formatted as follows:

GET /admin/smart_collections/#{smart_collection_id}/products.json

The products array in the response includes the manually_sorted property, which is a boolean that indicates whether a product is sorted manually within the smart collection. The products are returned in the same order that they appear on the storefront, with manually sorted products appearing at the top of the list and automatically sorted products displayed based on the sort_order of the smart collection.

Response

Filter products

When requesting products that are associated with a smart collection, you can choose to filter by manually-sorted products or automatically-sorted products. By default, all products are returned.

GET /admin/smart_collections/#{smart_collection_id}/products.json?only_sorted=only_manual

Respone

Cursor-based pagination

When requesting products that are contained in a smart collection, you can paginate products using cursor-based pagination. A cursor is a string of characters that marks the position of an item in a list of data. Unless this item is deleted, the cursor will always point to the same part of the list. When implementing cursor-based pagination, you can use the before and after parameters to return products either before or after a given cursor. The limit of results returned is set by the endpoint's page size (50), unless the results returned are fewer.

GET /admin/smart_collections/#{smart_collection_id}/products.json?after=eyJsaW1pdCI6NTAsInNvcnRfZmllbGRzIjoibGluZV9pdGVtc19jb3VudCIsInNvcnRfZGlyIjoiZGVzYyIsImxhc3RfaWQiOjYzMjkxMDM5MiwibGFzdF92YWx1ZSI6WzAuMCwzXSwiZGlyZWN0aW9uIjoibmV4dCJ9--86ee39f2c9a3a8491c2d751f3a5968411dd24c1b&only_sorted=all

Respone

Sign up for a Partner account to get started.

Sign up