Upcoming changes to SmartCollection API

Shopify Staff
Shopify Staff
40 0 9

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 mid October, 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.

This change means that the manual setting of the sort_order property will be deprecated, and that the order endpoint, like Shopify's admin, will be limited to manually sorting 250 products.

 

Deprecation Schedule

From mid October to early December 2018, 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.

 

For more information on the changes, please see the migration guide. There are some planned additions we'll be making to the guide, and if you have any questions which aren't answered, please let us know.

0 Likes
Shopify Partner
660 0 104

Until January 2018, you can continue to use the Collect resource to retrieve the position of products in smart collections. However, the smart_collections/products endpoint provides better performance and more accurate results than the Collect resource.

I guess it's a typo and should be 2019.

Does this mean that after that date we cannot use the Collect resource for smart collections?

Also, in what way is the Collect resource 'less accurate?

Thanks in advance.

 

0 Likes
Shopify Staff
Shopify Staff
40 0 9

Thank you for catching that typo!

 

Does this mean that after that date we cannot use the Collect resource for smart collections?

Yes, January 2019 is ambitious, it will likely be a bit later in the year, but Collects will no longer include membership for Smart Collections once deprecated. That being said, we are very open to feedback, and if there are specific features or issues with the Collects resource for Smart Collections, please let us know so that we can consider addressing these as we roll out new APIs.

Also, in what way is the Collect resource 'less accurate?

Collects periodically get rebuilt, to ensure that the membership of a collection is accurate. When you update a product, and it now becomes part or no longer part of a Smart Collection, we eventually run a job which will update Collects to ensure that its membership is accurate, and also its position according to the sort order of the Collect.

With the new smart_collection/{id}/products endpoint, collection membership is calculated dynamically upon request, so you get the most up to date membership information for a collection. It will also offer offset pagination, which will ensure the query is more performant, especially for large collections. The API documentation will be updated shortly to provide exact pagination details, but it will resemble what we've implemented on the GraphQL APIs.

 

Let me know if that leads to additional questions or feedback. 

Thank you!

0 Likes
Shopify Partner
660 0 104

I see.

It sounds like the new products endpoint is better!

 

0 Likes
Tourist
8 0 2

Hello!

How about custom collections? Are you going to add the same endpoint for them?

0 Likes

Hey Dominique,

This is a great change, and will simplify a lot of work around grabbing products associated with a SmartCollection!

Two quick questions:

1- Is the array returned by the new smart_collection/products endpoint already sorted correctly? This is not stated in the documentation (at least not how I read it), and I cannot see a "sort_position" attribute on the objects.

2- Can we use this endpoint now? You say it's being rolled out from Mid October (next week), so want to be sure I can update now and be ready for it ahead of time.

My use case is to grab the top 50 products from a SmartCollection according to whatever sort order the merchant has chosen. Currently this involves changing the sort to "manual" (which triggers the job to re-calculate the current positions on Shopify's side), waiting a couple of seconds, then grabbing ALL collects, sorting them and finally grabbing the products.. then to finish off, set the sort back to whatever it was. Will be awesome to be able to do this in just a single API call.

Many thanks,
Bjorn

Bjorn Forsberg | FORSBERG+two | Award-winning Shopify Apps since 2011
0 Likes
Shopify Partner
11 0 6

Hi Dominique,

Overall this looks like a great change for both merchants and developers.

My app Best Seller Insights currently sorts collections by my own best seller calculations if they were sorted by Shopify's best selling sort. 

I have a few follow-up questions:

1) Since the manual sort_order is going away, what will you set the collection sort order to for Smart Collections that are currently set to "manual"?

2) Will manually sorted products always show at the top of every collection page or only if no sort_order is specified (such as by the Sort By drop down)?  If it is always, that would make changing the collection sort order seem like it doesn't work if up to the first 250 products never change.

3) Will merchants have an easy way to disable or clear the manually sorted products for Smart Collections in the Shopify Admin?  Since a merchant might uninstall my app while many of their collections have manually sorted products, I think it is important they can easily switch back to the non-manual approach.  I see you can disable it from the API too, but often merchants uninstall so it is too late to disable via the API.

Thanks!

Tom

⭐️ Flair product badges https://apps.shopify.com/flair ⭐️ Best Sellers - https://apps.shopify.com/best-sellers
0 Likes
Shopify Staff
Shopify Staff
40 0 9

Hi everyone,

 

Thank you for all of the feedback! I've also created a Collect API Feedback Form to collect any additional feedback you may have on the Collect API in general, since we have an opportunity to address some of it when we release an alternative solution.

I've tried to address most of your questions below.

 

How about custom collections? Are you going to add the same endpoint for them?

There isn't currently a plan to add a /custom_collection/{id}/products endpoint. Can you tell me what you'd like to use it for, and what problem you're trying to solve that our existing APIs don't work well for? We do have /products.json?collection_id=12346.

 

1- Is the array returned by the new smart_collection/products endpoint already sorted correctly? This is not stated in the documentation (at least not how I read it), and I cannot see a "sort_position" attribute on the objects.

Yes. It is sorted by the default sort order that is used for displaying products in a smart collection on storefront. We'd love to get away from exposing a "position" field in any new APIs, which requires us to do non-performant updates to keep these in sync, even when they aren't required for querying products in an accurate sort order.

2- Can we use this endpoint now? You say it's being rolled out from Mid October (next week), so want to be sure I can update now and be ready for it ahead of time.

We've been planning to expose /smart_collection/{id}/products only for shops that have this new feature enabled, which would require you to know when the feature is enabled as mentioned above.

The endpoint will be available mid-October, at which point you can start testing on your partner shop if you have the Manual Sort feature enabled, which can be requested by contacting deprecations@shopify.com. We won't enable this feature on merchant shops until a bit later.

Do you always do a GET on the smart collection prior to using that endpoint?

I've been debating adding a field to smart collections so that API clients can know, without querying products, whether a collection uses the feature, and also whether it has manually sorted products. Say "manually_sorted_products" : true if there are some, false if not, and that field would not be present if the new feature isn't enabled on that shop. I still have to determine whether we can do that in a performant way, but would that work?

If that isn't ideal, since you don't currently do a GET, I can look to see if there is a meaningful way to ensure this endpoint works on shops that don't have the feature enabled. Keep an eye on announcements for the final version of the API.

1) Since the manual sort_order is going away, what will you set the collection sort order to for Smart Collections that are currently set to "manual"?

The products which are no longer manually sorted will be sorted according to "best selling" sort order. For collections with fewer than 250 products, all of their products will be manually sorted but the automatic sort order for that collection will default to "best selling".

2) Will manually sorted products always show at the top of every collection page or only if no sort_order is specified (such as by the Sort By drop down)?  If it is always, that would make changing the collection sort order seem like it doesn't work if up to the first 250 products never change.

Yes, they always show at the top. And yes, changing the sort order won't have any impact if all products in the smart collection are manually sorted. however, any number of these can be removed from being manually sorted. You can choose to have no manually sorted products in a smart collection.

3) Will merchants have an easy way to disable or clear the manually sorted products for Smart Collections in the Shopify Admin?  

 Yes! They will be able to remove them all very easily. 

 

Dominique


 

0 Likes
Shopify Partner
11 0 6

Hi Dominique,

Thanks for your thorough responses.  

Yes, they always show at the top. And yes, changing the sort order won't have any impact if all products in the smart collection are manually sorted

I think this may be worth further consideration.  

As a shopper, if I want to see the cheapest items or newest items, I would expect the Sort By dropdown to work accordingly.  I have several merchants that care a lot about showing specific recent best sellers at the top of their collections.  However, this change would mean essentially breaking (from the point of view of the shopper) the Sort By feature for anything other than the sort by Best Selling.

Wouldn't it make more sense to only use the Manually sorted products for the default collection sort?  i.e. - if no sort order is specified, then include the manual sorted products + the default sorted products.

Then if a sort_order is specified only return the sorted products without the manual overrides.

This would let you have the best of both worlds without compromising other sort order options.

Let me know what you think.

- Tom

⭐️ Flair product badges https://apps.shopify.com/flair ⭐️ Best Sellers - https://apps.shopify.com/best-sellers
0 Likes
Shopify Staff
Shopify Staff
40 0 9

Hi Tom,

I think I misunderstood your question. On storefront, the default sort order will always consider manually sorted products followed by automatically sorted products. However, if a sort_order is specified, it will override all sort order and all products will be sorted by that sort order. So for a shop, such a this one, which has a drop down on their theme, the drop down will continue to behave as expected.

In the above response, I was referring to how existing smart collections with manual sort order are being converted to ake advantage of the new manual sort feature.

Dominique

1 Like