Topics covering webhook creation & management, event handling, Pub/Sub, and Eventbridge, in Shopify apps.
Hello Shopify Team,
We are trying to fetch the "barcode" from the "orders/paid" and "orders/updated" webhook response. We couldn't find the barcode from the API responses as well the Shopify documentation.
Is there any way to get the product barcode in the line items section of the Shopify Order API or Shopify Webhooks?
Solved! Go to the solution
This is an accepted solution.
Webhooks for orders don't appear to have a field for barcodes, but you should be able to use the GraphQL API to query the `order` object to get line items's barcodes like this:
{
order(id: "gid://shopify/Order/5402053902550") {
id
lineItems(first: 10) {
edges {
node {
id
variant {
id
barcode
}
}
}
}
}
}
When I tested this out it returned a test barcode that I added:
{
"data": {
"order": {
"id": "gid://shopify/Order/5402053902550",
"lineItems": {
"edges": [
{
"node": {
"id": "gid://shopify/LineItem/13419036344534",
"variant": {
"id": "gid://shopify/ProductVariant/44835344515286",
"barcode": "234567890-"
}
}
}
]
}
}
},
Hope this helps!
Liam | Developer Advocate @ 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
This is an accepted solution.
Webhooks for orders don't appear to have a field for barcodes, but you should be able to use the GraphQL API to query the `order` object to get line items's barcodes like this:
{
order(id: "gid://shopify/Order/5402053902550") {
id
lineItems(first: 10) {
edges {
node {
id
variant {
id
barcode
}
}
}
}
}
}
When I tested this out it returned a test barcode that I added:
{
"data": {
"order": {
"id": "gid://shopify/Order/5402053902550",
"lineItems": {
"edges": [
{
"node": {
"id": "gid://shopify/LineItem/13419036344534",
"variant": {
"id": "gid://shopify/ProductVariant/44835344515286",
"barcode": "234567890-"
}
}
}
]
}
}
},
Hope this helps!
Liam | Developer Advocate @ 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