Barcode in Order API

tneill
Visitor
2 0 2

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.

Replies 5 (5)

GrahamS
Shopify Staff (Retired)
193 36 53

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

To learn more visit the Shopify Help Center or the Community Blog.

tneill
Visitor
2 0 2

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.

PaulNewton
Shopify Partner
6275 574 1324

 


@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 

Save time & money ,Ask Questions The Smart Way


Confused? Busy? Get the solution you need paull.newton+shopifyforum@gmail.com


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Buy Paul a Coffee for more answers or donate to eff.org


AftonCandle
Visitor
2 0 0

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

Iansz
Excursionist
15 0 10

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?