Covers all questions related to inventory management, order fulfillment, and shipping.
Hello,
As part of our store implementation, we are creating Orders through the Admin API. Our fulfillment team prints a UPS/USPS label from the Admin interface after selecting the calculated shipping rate. That all works wonderfully.
We're looking to capture the actual calculated shipping rate to account for our total costs.
However, even after the order is fulfilled, the `shipping_lines` array is null.
I'm hoping this is something simple that I'm missing, or there's some super secret way to get it.
Any ideas on how I can retrieve this data? Thanks so much in advance.
-Matt
Hey Matt,
Shipping labels are not currently exposed in the Orders API endpoint, I'm afraid. Just to clarify though, is it purely the shipping label price that you're trying to access for reporting reasons?
If so, there may be a workaround for you here via our Event API. It'll likely take some parsing in order to get the data you want programmatically, but if you were to use the event endpoint (ex. https://shop-name.myshopify.com/admin/orders/your_order_id/events.json) on an order you purchased a shipping label for, you should see a corresponding order event for that label purchase.
The event should have a 'verb' of "shipping_label_created_success" - and that event's 'message' would contain something like "You purchased a shipping label for $9.50 USD." as an example, giving you the price of the label that was purchased.
Hope that helps!
Josh | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
Hi Josh,
Is there a way to get this data from the Shopify Flow app?
Any update on when it will be available to get from the Orders API?
We absolutely need this... please!
Just to let thread still alive ....
Hope have something soon ... if is still no available ( I am not working on this right now)
Best Regards
Any updates?
Is there any update on this, this is quite important to build our app.
I now there are quite a few people in here reading this.
Have you guys been successful fetching the shipping_label_created_success verb on the events endpoint ? ( It's not in the documentation as well. )
Even if I list all events in the collection there is now event with this verb.
Kind regards,
@LukeG the code below is a little snippet of C# that is getthing the rates back for me. This one threw me because I wasn't getting the value for *every* shipped order. When I dug into it I found there are actually two that can get recorded. Let's hope not three 😉
DataRow[] rows = eventsDS.Tables["events"].Select("verb = 'shipping_label_created_success' or verb = 'external_shipping_label_created_success'");
Hi there, thank you for your response.
I'am using node.js on the backend and had trouble querying for this verb(s). Turns out it's only availbale when you use the order endpoint:
GET /admin/api/2020-10/orders/450789469/events.json
However the offical node.js library does not support this endpoint yet so I had to implement that on my own.
The query itself is quite straight forward:
let params = {
verb: "shipping_label_created_success"
};
const shopify = new ShopifyAPI({
apiVersion: '2020-10',
shopName: url,
accessToken: auth_token,
autoLimit: true
});
let events = await shopify.event.list(orderID, params)
console.log(events);
I hope this helps,
Is the events API and parsing text from a log entry, still the only way to get shipping costs?
Is there any other api which can provide us the shipping cost in any specific node?. Currently we need to parse this from events.
Any new api to get the Shipping Costs?
wouldn't that be nice!!
But, as far as I can tell, there is no better way to get the shipping costs for an order (or a fulfillment) then sussing it out of the message string of the label events as described earlier in this thread.
The events that I look for, parse, and then tally to get the total shipping costs for an order (assuming there may be more than one shipping event):
Also, very disappointed to discover that I can't use this same hackish method to get the costs for any return labels that might have been printed for an order.
An event for a return label looks like this:
{
"id": 2345234523452345,
"subject_id": 7890789078907890,
"created_at": "2021-05-27T15:21:13-04:00",
"subject_type": "Order",
"verb": "return_label_with_return_created_success",
"arguments": [
12341234123,
"shipping_label_1234.pdf",
"#1048-R1"
],
"body": null,
"message": "USER NAME created a return label for return #1234-R1.",
"author": "USER NAME",
"description": "USER NAME created a return label for return #1234-R1.",
"path": "\/admin\/orders\/7890789078907890"
}
which makes no reference anywhere to the label cost.
Ugh! Please deliver a method for us to access our shipping costs, Shopify Dev team. I know you must be busy, but this one is pretty essential!
Having access to this data is critical to running an efficient shipping program and it's hard to understand why shopify doesn't make this a formal part of the API, but I'm not holding my breath for shopify to add anything new to their API, we have not seen a lot of innovation from Shopify in that department in a very long time as far as I can tell.
Hi Matt,
Any word on when this might be implemented. Seems like a pretty reasonable ask for those using Shopify Shipping.
Thanks,
Sam
Bumping this to keep it relevant. I would love to be able to go to our CFO and justify why we are using Shopify for fulfillment. To do that I would need to show him the carrier/cost/shipping address/dimensions/weight for every shipment and use that same information to create sample freight costs for various carriers.
I don't expect Shopify to spoon feed us what I need. I do, however, expect them to at least expose the data needed to accomplish it ourselves.
I completely agree. It would be a godsend if we were given access to Shopify's Shipping API. The rates are great, but it's very tricky to integrate an accurate dimensional-weight-based shipping app if it's going to over and undercharge customers with every order.
Here is another vote that the ability to get shipping costs from the API is an important feature that would help Shopify merchants be successful. Hope to see it soon.
I have a follow-up with how I solved the problem.
I contacted my UPS Account Representative and explained to them the situation and asked if they could match the rates Shopify gave us. It took a few days of signing documents and emailing, but now my business's rates closely matches with Shopify's UPS rates now reasonably within an extra $2.00 USD for the fastest service, and it's pretty spot on for the slower services.
If you do not know your UPS rep, you should ask the UPS driver who delivers and pick-ups your packages. They receive some sort of incentive to provide the contact information.
Our current rates aren't nearly as good as the Shopify rates but that would be a great solution if our rep was able to match them. Thanks!
Hi Josh,
I just came across this post as I also need shipping cost for reporting purposes.
It would be great to add it on the order.shipping_lines[]
Also, regarding your work around. This verb is in the documentation. Is it safe to use?
And I also see no webhooks to subscribe to events? (only fulfillment events)
Now I'm wondering if I can use that endpoint to access other data not available in the 'normal' api.
Is it possible to get an exhaustive list of all verbs?
Sorry for another question but do you have a sample json for a shipping_label_created_success?
Is it attached to the shop or to an order? If it's attached to a shop then I'm wondering how we can match it with an order....
Another customer requested a report pulling shipping label costs.
Any improvement planned in this area would be very welcome!
We managed to retrieve the shipping_label_created_success event.
We can parse the string but we are reluctant to doing so because any change in the text format would break the code.
Is it possible to change the event so that the amount is added to the arguments array property?
That would prevent parsing.
https://help.shopify.com/api/reference/events/event#arguments-property
@Inspire, it is possible to get the shipping cost. And, I'm sorry Josh doesn't seem to be able of helping. Use GraphQL and retrieve:
events(first:20) { edges { node { message attributeToUser } } }
... as part of order(). Then just parse the messages. Something like this:
for event in data["order"]["events"]["edges"]: e = event["node"] if(e["attributeToUser"]): m = e["message"] if "purchased a shipping label" in m: m = m[(m.find("$")+1):] endIndex = m.find(".", m.find(".")+1) m = m[:(endIndex)] deliveryCost = float(m) if m.isdigit(): deliveryEstimateComment = int(m)
@Josh, in the unlikely event that you read this, and even more unlikely event that you actually care (yes, that this point I'm quite cynical given that we've been asking for this for 2+ years). Please consider exposing the shipping labels. See my full explanation of why this is needed here: https://ecommerce.shopify.com/c/shopify-apis-and-technology/t/urgently-need-a-solution-for-downloadi...
I do read this, and have been chatting with Clement directly outside of the forums. I have already logged a request to make this available outside of reading order events.
Josh | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
Still no update on this issue?
We get regular requests from merchants trying to report on their shipping cost.
Bumping this because we still need a resolution for this if it does not exist yet.
Pulling Freight costs (what we paid to the carriers) out of Shopify is absolutely critical for us and needs to be a part of the standard framework.
+1 to make this data available in the Order API. Just got another request for it from a customer of our app.
Any updates on this ?
Seems to be crickets from Shopify on this one, and now I'm stuck as a result as well as all the rest of the community. This is basic stuff in a platform! We are dying without this ability to easily retrieve our data.
Status? Anything? Is it coming or is it a dead topic to Shopify?
(For those reading this in 2022+): This is available for a limited beta now, starting with the ability to purchase a label via an API. If interested, please email labels-api@shopify.com and lets chat about your needs.
To learn more visit the Shopify Help Center or the Community Blog.
Any updates? How can this basic feature not be available?
Also bumping this in 2024... still waiting for this to become native. I need this information in order to provide commissions to staff members. It's impractical to pull this information manually and separately on a per order basis when you're dealing with hundreds of orders. 😞
Any update since last posted? I'm confused why this would be in beta for over a year now.