is there any way to get list of vendors and type from shopify store using shopify API

Highlighted
New Member
10 0 0

Hello ,

I am new to shopify .

I am creating a app for product addition in the shopify . I want to replicate all functionality of the add product page of the shopify.

for that I need list of the vendors and type to show in the dropdown.

I have gone through api documentaion link (  http://docs.shopify.com/api/ ) but I am unable to see any api regarding vendor and type.

Can anyone please help me out?

 

0 Likes
Highlighted
Shopify Staff
Shopify Staff
582 0 48

You'll need to fetch all the products from the Shop. You can filter so you only get the vendor and type fields though

curl -H "X-Shopify-Access-Token: 123456" https://shop.myshopify.com/admin/products.json?fields=vendor,product_type

 

0 Likes
Highlighted
New Member
1 0 0

Hi @Chris_Saunders, with regards to the new public-facing Storefront API, how do we get a list of vendors using the Products GraphQL query? AFAIK, the products query is limited to 250 products, so trying to grab the entire list of vendors from 250 products is not accurate, especially when my store has over 1,000 products. Any workarounds for this?

 

I'm aware there's Admin API for this, but I will be using this vendor list for a public facing app rather than a private app. 

0 Likes
Highlighted
Shopify Partner
39 4 5

To get all of the product vendors iterate over the following query:

 

{
  products(first: 250, after: "#{cursor}") {
    edges {
      cursor
      node {
        id
        vendor
      }
    }
    pageInfo {
      hasNextPage
    }
  }
}

the after part should be ignored first query. Then put the cursor value of the last product returned as the argument for the after property next query until hasNextPage is false.

1 Like