Barcode in Order API

tneill
New Member
2 0 1

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 4 (4)
GrahamS
Shopify Staff
Shopify Staff
193 35 48

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

tneill
New Member
2 0 1

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
4209 303 901

 


@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 

Finally Combinable Discounts - EARLY ACCESS ONLY - Use Free Shipping With Other Discounts

Answers powered by coffee Buy Paul a Coffee for more answers or donate to eff.org
Problem Solved? ✔Accept and Like solutions to help future merchants
Confused? Busy? Buy a custom solution paull.newton+shopifyforum@gmail.com
AftonCandle
New Member
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