App reviews, troubleshooting, and recommendations
For context, I am requesting via node-fetch the Shopify Admin REST API orders.json with the queries shown in my code. For some reason, this only returns the latest order regardless of if I add status=any or limit=250 (which is the standard limit for orders). Before I go too much into detail let me show my code so you can understand the query.
const User = require('../models/User.model');
const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args));
const getReportsPartner = async (req, res, next) => {
const user = await User.findById(req.user.id)
const url = 'https://astore.com/admin/orders.json?fields=total_price_usd,line_items';
const headers = {
'X-Shopify-Access-Token': 'anaccesstoken',
'Content-type': 'application/json',
'Authorization': 'anauthkey'
}
fetch(url, { method: 'GET', headers: headers })
.then(res => res.json())
.then(json => {
const orders = json.orders[0]
console.log(orders)
const partner = orders.line_items[0].title
const commission = (orders.total_price_usd * .125).toFixed(2)
res.render('reports/partnerReport', { partner: partner, commission: commission })
})
}
module.exports = { getReportsPartner }
https://astore.com/admin/orders.json?fields=total_price_usd,line_items.title=something
https://astore.com/admin/orders.json?fields=total_price_usd,line_items&line_items.title=something
I have also tried line_items[0].title=something in the url as well, however this seems to invalidate the entire request. I appreciate any help you can give. If you need more in terms of context let me know. Ultimately I plan to get recent orders by title and graph the orders and commissions in a report format. For future orders I will be using a webhook, so at the moment I am only worried about past.
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025