App reviews, troubleshooting, and recommendations
Hi,
Hoping someone can help as I've been stuck on this for over a week now and have tried various methods, but I am struggling to fetch all my orders using the shopify API in the template app. I can fetch order count no problem, but I am struggling with fetching the open orders. Here's the code I am using:
app.get("/api/orders", async (_req, res) => {
const orderData = await shopify.api.rest.Order.all({
session: res.locals.shopify.session,
status: "open",
});
res.status(200).send(orderData);
});
Thanks,
Hello @w3d0nts1eep,
I am Gina from flareAI app helping Shopify merchants get $6Million+ in sales from Google Search, on autopilot. Hope you are having a good day.
There might be a problem with the code you provided.
1. Ensure that you have properly authenticated the API request. Make sure that `res.locals.shopify.session` contains the valid credentials required to access the Shopify API.
2. Confirm that you are using the correct API endpoint to fetch orders. The correct endpoint for fetching all orders is `"/admin/api/2023-01/orders.json"`. Make sure that you are making the API call to the correct URL.
3. Ensure that the order status parameter is set correctly. In your code snippet, you are passing `status: "open"`. Double-check that this is the correct value to retrieve open orders. You can also try removing the `status` parameter temporarily to fetch all orders regardless of their status.
4. If you have a large number of orders, the API response might be paginated. Make sure you handle pagination properly to retrieve all orders.
5. Check if there are any error messages or exceptions being thrown during the API call. Make sure you have appropriate error handling in place to capture and handle any errors that may occur during the API request.
By reviewing and addressing these aspects, you should be able to troubleshoot the issue of fetching all orders using the Shopify REST API in your app.
Gina
1. Can you double check if shopify.api.rest.Order is correct? I think shopify.rest.Order is correct.
2. If shopify.api.rest.Order is correct, can you try to fetch any orders?
app.get("/api/orders", async (_req, res) => {
const orderData = await shopify.api.rest.Order.all({
session: res.locals.shopify.session,
status: "any",
});
res.status(200).send(orderData);
});
Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025