Development discussions around Shopify APIs
Are there any plans to include the product barcode in the line items section of the Shopify Order API? For POS users the barcode is a useful link between Shopify product variants and back end systems.
Hey @tneill ,
What you're looking for is not currently in the works for REST API, however it is more than possible to query with GraphQL.
The most barebones query you could run for grabbing a barcode for a product on an order would look something like this:
query {
order(id: "gid://shopify/Order/123456789"){
lineItems(first:10){
edges {
node {
variant{
barcode
}
}
}
}
}
}
Which would return an output like:
{
"data": {
"order": {
"lineItems": {
"edges": [
{
"node": {
"variant": {
"barcode": "8675309"
}
}
}
]
}
}
},
"extensions": {
"cost": {
"requestedQueryCost": 23,
"actualQueryCost": 5,
"throttleStatus": {
"maximumAvailable": 1000.0,
"currentlyAvailable": 995,
"restoreRate": 50.0
}
}
}
}
I hope this helps!
Best,
Graham
Graham S | API Support @ 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 Shopify.dev or the Shopify Web Design and Development Blog
Thanks for getting back to me Graham – I’m using Integromat to integrate with Shopify and as it is built on the REST API your suggestion is not currently an option for me. However I have a simple workaround in that I will just swap the barcode and sku fields in Shopify and extract the barcode data from the sku field as it is our primary way to identify product variants on our back end systems.
Best regards,
Tom.
@tneill wrote:.. I have a simple workaround in that I will just swap the barcode and sku fields in Shopify and extract the barcode data from the sku field.
... our back end systems
💣Careful there , this can cause confusing issues when skus are exposed in anyway to customers but are not the proper support data.
Double check your frontends, theme and order notifications and support docs.
It would be better to see if you can take advantage of the new metafield definitions to specifically request data you specifically structure instead of overloading existing properties.
https://help.shopify.com/en/manual/metafields/metafield-definitions
Or use an automation app like usemechanic to script task automatically creating metafields from the information in the barcode data. (or just used it to automate the barcode to sku mapping)
https://tasks.mechanic.dev/?q=barcode
It would seem like this would be a quick and easy fix to the API. Why uses sku and not barcode as well? We also need this to integrate through a 3rd party.
Thank you
Hello
Could you inform of the reason why the Barcode is not included in the API, it seems like the only value not included of which I could really use.
Is there some technical reason?
User | RANK |
---|---|
6 | |
5 | |
5 | |
5 | |
4 |
Learn these 5 things I had to learn the hard way with starting and running my own business
By Kitana Jan 27, 2023Would you love to unleash the unbridled power of the Google Shopping Channel into your sho...
By Gabe Jan 6, 2023How can you turn a hobby into a career? That’s what Emmanuel did while working as a wa...
By Skye Dec 30, 2022