Can Shopify provide a nested hierarchy of categories via the API please?

New Member
3 0 0

Hi there,


Can Shopify provide a nested hierarchy of categories via the API please?

As distinct from collections  - GET /admin/api/2019-04/custom_collections.json?product_id={product_id}  by each product id(Shopify's internal id). Connections would mean that if a retailer client has 1 million products, then to retrieve categories for all of these products we have do 1 million HTTP calls to collections endpoint. 

Our company, Mercanto, is a product merchandising platform, specialising in email personalisation.

This is a really important question (showstopper) for us, so any help or feedback would be very gratefully received and much appreciated.  

Thank you!

Peter


0 Likes
Highlighted
Shopify Staff
Shopify Staff
298 32 59

Hey Peter,

 

What exactly are you referring to by "categories". Do you mean the `product_type`?

 

The `/admin/custom_collections.json` endpoint returns a payload with the following structure (in an array):

{
      "id": 841564295,
      "handle": "ipods",
      "title": "IPods",
      "updated_at": "2008-02-01T19:00:00-05:00",
      "body_html": "<p>The best selling ipod ever</p>",
      "published_at": "2008-02-01T19:00:00-05:00",
      "sort_order": "manual",
      "template_suffix": null,
      "published_scope": "web",
      "admin_graphql_api_id": "gid://shopify/Collection/841564295",
      "image": {
        "created_at": "2019-05-09T13:28:36-04:00",
        "alt": "iPod Nano 8gb",
        "width": 123,
        "height": 456,
        "src": "https://cdn.shopify.com/s/files/1/0006/9093/3842/collections/ipod_nano_8gb.jpg?v=1557422916"
      }
}

If you could specify exactly what field you're looking for on what object, I can do some digging to see if a bulk query is available.

1 Like
New Member
3 0 0

Hi Zameer,

Many thanks for this.  

You may know that retailers often use categories, for example here's a big UK retailer - https://www.johnlewis.com/
Who has:

Level 1 category - Women
Level 2 category - Dresses

Is this the same as collections?  If so, can Shopify do nested collections, for example, Women/Dresses?

Thanks!
Peter




0 Likes
Shopify Staff
Shopify Staff
298 32 59

Yes, Shopify refers to these groupings of items as `collections`.

 

Your question doesn't necessarily have one specific answer. Merchants are free to organize their products as they like, and also choose how they are displayed, which often comes down to their theme implementation.

 

In general, both CustomCollections and SmartCollections are used to organize products into specific groupings in the back-end. The theme then contains the logic regarding what collections to display for each menu/sub-menu item. 

 

For example, some Shopify merchant might have one collection where they display all of their men's jeans (https://www.someapparelcompany.com/collections/mens-jeans) which can be accessed by going to `Mens > Jeans` in their navigation menu. They may also have another more specific collection for just men's skinny jeans (https://www.someapparelcompany.com/collections/mens-skinny-jeans) which can be accessed by going to `Mens > Jeans > Skinny` in their navigation menu.

 

Unfortunately, we don't currently have a Navigation API which lets you obtain menu items programmatically. However you are able to retrieve a list of all products that exist in each collection via the Collect API. 

0 Likes
Shopify Partner
1704 47 151

You'll want to make your own convention for how to use shopifys flat collection model to impose your own hierarchies.

Dont confuse the model for the UI presentation.

So:

CollectionA+CollectionB = CollectionACollectionB

aka Womens+Dresses = WomensDresses

 

 


@PJD wrote:

Connections would mean that if a retailer client has 1 million products, then to retrieve categories for all of these products we have do 1 million HTTP calls to collections endpoint. 


Bad example or miswording? So what if they have 1 million products? If they have also have no predefined collections any concept of "subcollections" is irrelevant and you'd still have to make those 1 million calls.

Or are you talking about trying to get the names of all collects on a shop? Which is different from trying to find out products in a collect or collects that have a product.

 

 

 

Problem Solved? ✔️Accept the solution so you can help others.
Confused? Busy? ? Get me to solve it paull.newton+shopifyforum@gmail.com.
Buy me a coffee? ☕ paypal.me/paulnewton or donate to eff.org
0 Likes