Get total count of products by page
This method returns the total number of products associated with a specific catalog page URL. It is useful for pagination when you need to know how many products exist on a given page, including or excluding nested child pages.
✅ Purpose of the scenario:
- Get the count of products on a specific catalog page
- Distinguish between direct products and products including nested pages
- Use count for pagination on category or catalog pages
✅ What you need:
- A valid PROJECT_URL and APP_TOKEN for authentication with the OneEntry API.
- At least one catalog page with products in the project
- The URL (page marker) of the target catalog page
📌 Important:
- These examples do not include error handling.
- You can manage errors using a try-catch block or by employing a construction like await Promise.catch((error) => error).
- Pass an empty array [] to count all products on the page without filtering.
- totalInCategory counts only products directly on the given page; totalInCategoryWithNested also includes products on child pages.
Loading sandbox…
