shopifyshopify-app

Does shopify products have category?


I working on an e-commerce website, similar to ebay, Etsy, etc

I want to build an app, where someone with a shopify store can sync their products on my e-commerce website... so, I want Shopify to be the source of information and I want to create the corresponding products on my website.

What I don't know is how to determine the category of the product... my e-commerce website, has it's own categories, for example, women:shirts, men:shirts, women:shoes, sports:shirts, sports:camping-gear, etc

I can see the I can read product info from shopify, but is there any way that I could determine which category I should use? I cannot see any category info in shopify, it's only product title, and description... Does shopify have a category for each product that I could map to my categories?


Solution

  • In Shopify Community, categories are referenced as Collections.

    Basically there are two types of collection

    1. Custom Collection ( merchant add a product to this collection manually )
    2. Smart Collection ( Assign to the product automatically based on rules define while creating this collection )

    But if you are using Rest Admin API and fetching product list you will not be able to get a collection name or ID in a single API call.

    But can be possible with new GraphQL API.

    The query will look like below.

    query{
      products(first : 50){
        edges{
          node{
            collections(first : 5){
              edges{
                node{
                  title
                }
              }
            }
          }
        }
      }
    }
    

    Hope this will help.