You can't get more than 250 products with a single request from Shopify.

Refer to the docs here: https://shopify.dev/docs/admin-api/rest/reference/products/product?api[version]=2020-04 ( where the limit max value can be 250 )

In order to get more than 250 products you need to make a recursive function and use the page_info argument to make paginated requests. More on the matter can be seen here: https://shopify.dev/tutorials/make-paginated-requests-to-rest-admin-api

When you make a request and there is a pagination shopify returns a header similiar to this one:

Link: "<https://{shop}.myshopify.com/admin/api/2019-07/products.json?page_info=vwxyzab&limit=6>; rel=next"

In order to make a request to the second page you need to grab the link and make a request to it, the same applies when you make that request, there will be the same header if there are more pages and so on.

So you need to get your response header and the link from it and make it recursive:

function makeRequest(nextLink = '{STORE URL}/products.json?limit=250'){
  return new Promise((resolve, reject) => {
    fetch(nextLink).then(r => {
      const headerLink = r.headers.get('link');
      const match = headerLink.match(/<[^;]+\/(\w+\.json[^;]+)>;\srel="next"/);
      const nextLink = match ? match[1] : false;
      if(nextLink){
        makeRequest(nextLink)
      } else {
        resolve();
      }
    })
  })
}
Answer from drip on Stack Overflow
Top answer
1 of 2
15

You can't get more than 250 products with a single request from Shopify.

Refer to the docs here: https://shopify.dev/docs/admin-api/rest/reference/products/product?api[version]=2020-04 ( where the limit max value can be 250 )

In order to get more than 250 products you need to make a recursive function and use the page_info argument to make paginated requests. More on the matter can be seen here: https://shopify.dev/tutorials/make-paginated-requests-to-rest-admin-api

When you make a request and there is a pagination shopify returns a header similiar to this one:

Link: "<https://{shop}.myshopify.com/admin/api/2019-07/products.json?page_info=vwxyzab&limit=6>; rel=next"

In order to make a request to the second page you need to grab the link and make a request to it, the same applies when you make that request, there will be the same header if there are more pages and so on.

So you need to get your response header and the link from it and make it recursive:

function makeRequest(nextLink = '{STORE URL}/products.json?limit=250'){
  return new Promise((resolve, reject) => {
    fetch(nextLink).then(r => {
      const headerLink = r.headers.get('link');
      const match = headerLink.match(/<[^;]+\/(\w+\.json[^;]+)>;\srel="next"/);
      const nextLink = match ? match[1] : false;
      if(nextLink){
        makeRequest(nextLink)
      } else {
        resolve();
      }
    })
  })
}
2 of 2
7

Two cases are here:

Case 1: You have the admin access. You can simply paste the below code snippet into your theme.liquid file and get all product data in browser console.

<script>
  const total_products = {{- shop.products_count | default : false -}};
  if(total_products){
    let storeProducts = [];
  let fetchCalls = [];
  let ceailedCount = Math.ceil(total_products/250); 
  for (let i =1 ; i <= ceailedCount; i++ ){
    fetchCalls.push(fetch('/products.json/?limit=250&page='+i))
  }
  Promise.all(fetchCalls)
  .then(m => m.forEach(s => {
    let k = s.json();
    k.then( s => { storeProducts.push(s.products) })
  }
  )).then( j => console.log('process Completed',storeProducts ));
  }
</script>

Case 2: You are viewing the website as a customer. In this case, you must first know how many total products are in the store, which you can get by making the below Ajax calls within the browser console. All you have to do is run the below fetch calls one by one in the browser console until less than 250 products or no product array is returned.

fetch('/products.json?limit=250&page=1').then(r => r.json()).then( p => console.log(p));

fetch('/products.json?limit=250&page=2').then(r => r.json()).then( p => console.log(p))

fetch('/products.json?limit=250&page=3').then(r => r.json()).then( p => console.log(p))

fetch('/products.json?limit=250&page=4').then(r => r.json()).then( p => console.log(p))

fetch('/products.json?limit=250&page=5').then(r => r.json()).then( p => console.log(p))
//and so on... until you are getting product results.

Note that; all the fetch calls are the same, just the page number is different. Each Fetch call returns us up to 250 products. When you keep making fetch calls in the same order, and the last fetch call will return either no product or less than 250 products. Which is the last fetch call you have to make. Consequently, you know the total number of products, ( 250 times page number ). Note the page number of that last call and then run the below code ( REPLACE THE PAGE_NUMBER WITH YOUR NUMBER )

    let storeProducts = [];
  let fetchCalls = [];
  let ceailedCount = PAGE_NUMBER; 
  for (let i =1 ; i <= ceailedCount; i++ ){
    fetchCalls.push(fetch('/products.json/?limit=250&page='+i))
  }
  Promise.all(fetchCalls)
  .then(m => m.forEach(s => {
    let k = s.json();
    k.then( s => { storeProducts.push(s.products) })
  }
  )).then( j => console.log('process Completed',storeProducts ));
  

Finally, you will get the all products in an array storeProducts

🌐
Shopify
shopify.dev › docs › api › ajax › reference › product
Product API reference
You can make a GET request for the information of any product using the Ajax Product API. All Ajax API requests should use locale-aware URLs to give visitors a consistent experience.
🌐
Shopify Community
community.shopify.com › retired boards › appdev › fulfillment api
Full product listing using REST API
August 23, 2023 - Hello: We want to retrieve a full list of our published products using the REST API at https://shopify.dev/docs/api/admin-rest/2023-01/resources/product#get-products The return list is limited to up to 250 items, but t…
🌐
API2Cart
api2cart.com › home › api technology
Shopify API Get All Products: A Complete Guide for 2025
September 23, 2025 - With a single integration through API2Cart, you can retrieve and manage customers, orders, products, and other essential store data from Shopify. You can also update order details, manage inventory, and create shipments easily, saving development ...
🌐
YouTube
youtube.com › watch
Shopify API | Lesson #1: How To Retrieve Products List With Postman In Shopify - YouTube
► Full Detailed Tutorial (Blog): https://www.beehexa.com/devdocs/retrieve-all-products-in-shopify-with-postman/Watch this demo to find out how Shopify can br...
Published   October 28, 2020
🌐
Shopify Community
community.shopify.com › shopify discussion
Need to export all the products using REST API
October 17, 2023 - You can fetch the products from Shopify using the API endpoint below with the GET method: GET - /admin/api/2023-01/products.json Once the product data is fetched, you can use it and create a CSV with custom code. https://shopify.dev/docs/ap...
🌐
Shopify
shopify.dev › docs › api › admin-rest
REST Admin API reference
The Admin API lets you build apps and integrations that extend and enhance the Shopify admin. Learn how to get started with REST endpoints.
Find elsewhere
Top answer
1 of 3
4

To get the Shopify Product Id and Product Variant ID, you can use Shopify REST API. Since, you already have the NodeJS application you can use the Shopify API Node.js Module. Just fetch all products, pass fetched data to frontend and then use the scripts mentioned in your question to render Shopify Buy button.

Sample code to get all products

const Shopify = require('shopify-api-node');

const shopify = new Shopify({
    shopName: 'store-url.myshopify.com',
    apiKey: 'xxxxxxxxxxxxxxxx',
    password: 'xxxxxxxxxxxxxx',
    autoLimit: true
});



shopify.product.count()
    .then(async (count) => {
        if (count > 0) {

            const pages = Math.ceil(count / 250);
            let products = [];

            for (i = 0; i < pages; i++) {
                // use Promise.all instead of waiting for each response
                const result = await shopify.product.list({
                    limit: 250,
                    page: i + 1,
                    fields: 'id, variants'
                });
                products = products.concat(result);
            }
            // products array should have all the products. Includes id and variants
            console.log(products);
        }
    })
    .catch(err => {
        console.log(err);
    });

For better performance, consider saving products in database and update information periodically.

Shopify REST API

2 of 3
1

This solution works with shopify-api-node in 2023:

    let products: IPaginatedResult<IProduct> = []
    let page_info: string | undefined = undefined

    // Get all products
    // page_info is the next page ID to fetch
    // https://shopify.dev/docs/api/usage/pagination-rest
    do {
        const newProducts = await shopify.product.list({
            limit: 250, // max is 250
            page_info
        })

        products = [...products, ...newProducts]
        page_info = newProducts.nextPageParameters?.page_info
    } while (page_info)
    
   return products

🌐
YouTube
youtube.com › watch
Shopify Tutorial for Beginners #19 Get ALL Shopify Products REST API - YouTube
Get ALL Shopify ProductsIs there an API call to list all available product id's (ID's alone Use Shopify API request to get all products using JavaScript How ...
Published   April 12, 2024
🌐
MageComp
magecomp.com › home › shopify › how to get shopify all products using admin rest api in remix?
How to Get Shopify All Products using Admin Rest API in Remix?
January 31, 2025 - In this article, we will learn about How to Get Shopify Store all Products using Admin Rest API in the Remix App.
🌐
Shopify Community
community.shopify.com › shopify apps
How to get more than 250 records through API
March 6, 2023 - I am working on a app where i need to fetch all the products from the shopify store but it allows only 250 products to be fetched at a time, how can i overcome this problem? Anyone?
🌐
Shopify Community
community.shopify.com › technical q&a
Get all Products in Shopify via Shopify API - Technical Q&A - Shopify ...
August 15, 2023 - Hi, I try to integrate with shopify API and have an issue. I would like to get all products from shopify and use Retrieve a list of products API. I would like to get 300 producs but in API limit parameters maximun is 25…
🌐
Google Groups
groups.google.com › g › shopify-app-discuss › c › iljg9MLHyqQ
How to get product's collections using API
Dave, Thanks for answer, but how can I "ask which collections a product belongs to". Thanks again. ... Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message ... http://api.shopify.com/customcollection.html notice you can ask for all the collections that have a product with id product_id?
🌐
Shopify
shopify.dev › docs › api › storefront › latest › queries › product
product - Storefront API
query Products @inContext(country: GB) { woolSweater: product(handle: "wool-sweater") { title } alarmClock: product(handle: "alarm-clock") { title } products(first: 2) { nodes { title } } } curl -X POST \ https://your-development-store.myshopify.com/api/2025-10/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Storefront-Access-Token: {storefront_access_token}' \ -d '{ "query": "query Products @inContext(country: GB) { woolSweater: product(handle: \"wool-sweater\") { title } alarmClock: product(handle: \"alarm-clock\") { title } products(first: 2) { nodes { title } } }" }'
🌐
YouTube
youtube.com › watch
How to Fetch Products from Shopify Admin API - JavaScript - Node JS - YouTube
In this video, I have explained step by step How to fetch products from Shopify using Shopify Admin API, in your JavaScript or Node JS application.Feel free ...
Published   September 13, 2024
🌐
HulkApps
hulkapps.com › home › shopify hub › a comprehensive guide on how to retrieve all products in shopify
A Comprehensive Guide on How to Retrieve All Products in Shopify
February 16, 2024 - Whether through code or Shopify's admin features, accessing all your products is both feasible and, to a great extent, user-friendly. What is the Shopify's API maximum limit for products retrieval? Shopify's API limits the retrieval to a batch of 250 products per request. Can I bypass the fetch limit by increasing the limit parameter? Increasing the limit parameter beyond 250 in the URL request will not exceed Shopify's set cap on the product list. How does pagination help in getting all products?
🌐
Shopify Community
community.shopify.com › shopify discussion
Retrieve products from collection using API
October 13, 2021 - I am creating a WhatsApp Sales ... on how I get retrieve the following: A product from a specific collection. I need just the Title, Description, Images and Price. A list of all the products in a specific collection. The Title only I am not very much familiar with using the Shopify API but would ...