What do you do if you have information about orders stuck in your back office system, like your ERP and you want to make that available to customers in their “My Account” area in BigCommerce? That can be a tricky problem. I think you can solve it with order metafields.
Hi, I’m Tom, I’m Innovation Director at Space 48, uh, and every day I’m looking to help people get the most out of their eCommerce platform, and unlock its potential. Um, that’s cheesy as, I can’t swear can I.
So how might we go about this? Order metafields are essentially custom, uh, attributes that you can put on a few different things in BigCommerce. We have things like categories, products, brands, uh, product variants, and orders. Some of these are available through the storefront API, which is a GraphQL-based API that you can request, and add to your theme, whether that being kind of through JavaScript or through, uh, stencil and front matter.
Unfortunately, orders aren’t available right now, as it stands. And so while you could set up a process to put this data in order metafields, say your custom invoice ID, you could put it in there, but you couldn’t get it out again very easily within your theme. The only way to get access to order metafields is through the management API right now. And that’s something you wouldn’t want to kind of surface or make available to your storefront, because it would just leak sensitive data and you need a way of identifying: should this person be able to view these, uh, this order or information about this? And so we have an app Metafields Manager to help people manage their Metafields.
Okay. Bet you’d never guessed. And I was reaching out to customers recently to see if they’ve got any feedback and one person came in touch, or got back in touch, uh, and shared that they had this precise problem. And I’d actually already laid out in a forum post, how you might tackle this.
You might achieve this with a Web app that accepts requests from the front end verifies that the person making that request should have access to, and order fetching the order metafields from BigCommerce and then returning them to the customer. Now that I appreciate that a part of me can feel good because I’ve found a problem, been the technical architect and shown someone the solution, but it kind of sucks to kind of just push back on them.
I appreciate just quite how much effort it would be to build that piece of functionality and worry about kind of the uptime of that little app. So why don’t we add that as our first API to Metafields Manager? And so that’s what I’m gonna take you through today.
BigCommerce has an API that you can use on the storefront called a current customer API. Simply make a request to it. And it will provide you with a special token called a JWT, which is an encoded version or an encrypted version of basic customer data, and it tells you who is logged in. So what the integration requires you to do, is make a request to this endpoint, provide that JWT to our API, along with, you know, what store and what order you would like to request information for. and then we will do the hard work to verify that customer, or authenticate them and then provide the order metafields back to you. So you can use those to update your order details page with the right information.
So, if you’re looking to update your customer account area, with all the details from back office systems, I hope that helps you whether or not you’re gonna do it yourself. Or perhaps even use our new API and our fancy app. I hope that helps you either way. Other than that, thanks very much.
Please feel free to, uh, comment, subscribe, and give your feedback in any way that you should see fit. Have a great.