Insight | Jul 16, 2018
How To: Flawless Integration Between Shopify and the AS/400
By Justin Emond
You know the famous literary line “It was the best of times, it was the worst of times”? Well, if your company uses an AS/400 system, then you know that it is only ever the worst of times.
When AS/400 + Shopify Plus is a Good Idea
The AS/400, officially called the IBM System i and first released as the AS/400 in 1988, is a common technology that sits at the center of many commerce business processes. Organizations typically store customer, order, stock level, and SKU product catalog information in the AS/400. This means that the warehousing, fulfillment, customer service, and finance teams all rely on the data in the AS/400 to do their jobs, among the most critical business processes in an organization.
For non-standard commerce experiences (think buying tickets for concerts at every American stadium), integrating with the AS/400 is likely not a great path to success and another commerce platform should be evaluated.
However, if your overall commerce site is a standard browse-and-buy experience, then integrating your AS/400 with Shopify Plus is an excellent approach to breaking free of the limitations of this old system while not breaking backend business processes. Despite the limitations of the AS/400, organizations can use Shopify Plus to offer a modern, powerful commerce digital experience for both business to business (B2B) and business to consumer (B2C) sales.
Here are the six keys to successfully integrating Shopify Plus with an AS/400:
#1: Build a custom Shopify app
The AS/400 is a highly-custom data storage layer, but that doesn’t prevent organizations from effectively integrating the AS/400 with Shopify Plus. However, it does mean you need to build a custom Shopify app to control how data flows between both systems.
The custom app needs to live on a fully-managed third-party hosting platform, like Heroku, and allow for bidirectional data flow (more on that later).
The Shopify custom app is essentially an application middleware and performs one crucial function bidirectionally. The middleware listens for event notifications (webhooks) from both the Shopify app and the AS/400 (see #5 below) and moves the relevant data related to the notification between the two systems.
For example, when Shopify notifies the middleware that a new order was completed, the middleware uses the Shopify API to gather all of the information about the API and then (likely using an ODBC connection) inserts that information into your AS/400 instance. This also works in reverse: When a product is updated in the AS/400, the middleware is notified so that it can flow all of the details about that particular product to Shopify.
#2: Carefully curate the system of record for individual fields
A product has many fields of data, like title, SKU, manufacturer, tags, price, stock level, images, tax information, currency, and product description, just to name a few. When you’re integrating of Shopify Plus with an AS/400, it’s crucial to clearly define which fields are going to be managed and edited in the Shopify Plus backend versus in AS/400.
The actual breakdown will likely vary from organization to organization, but typically looks like:
Data field |
System of Record |
Note |
Product title |
Shopify Plus |
Initially imported from AS/400 but edited in Shopify Plus |
SKU |
AS/400 | |
Manufacturer |
Shopify Plus |
Initially imported from AS/400 but edited in Shopify Plus. Be sure to carefully manage the manufacturer list between systems. |
Tags |
Shopify Plus |
This information may not even exist in the AS/400, or you may use the integration app to translates certain fields in the AS/400 into tags. |
Price |
AS/400 |
Price is crucial for fulfillment, inventory, warehousing, and finance, so it’s typically is managed in the AS/400. |
Stock Level |
AS/400 |
The integration app may need to include an extra step in the order data flow to ensure the inventory is properly updated in both systems. |
Images |
Shopify Plus |
Images likely aren’t stored in the AS/400. |
Product description |
Shopify Plus |
There is likely product description information in the AS/400, but it probably isn’t tuned for digital commerce, so marketing and merchandisers can edit their own copy in the Shopify Plus. You may consider having the description in the AS/400 flow into Shopify Plus when a new product is first added. |
#3: Data must flow bidirectionally
Data must flow bidirectionally through the integration layer and between the AS/400 and Shopify Plus—there’s no avoiding it. New products need to flow to Shopify Plus, as well as certain product data field changes, changes to customer information and order information (so the user dashboard is current), and of course inventory and stock level information. Shopify Plus must also send data to the AS/400 to track new orders, customer information, and stock changes.
Without bidirectional data flow, you create a myriad of problems. For example, if Shopify order information didn’t flow to the AS/400 your inventory levels would rapidly become inaccurate, creating stocking and fulfillment issues that would frustrate users. Conversely, if changes to product prices in the AS/400 were not reflected in Shopify automatically you would end up selling products to consumers at the wrong price.
#4: Test, test, test
When you integrate Shopify Plus and the AS/400, you’re essentially building middleware, which involves moving lots of varied, discrete data in two directions between two very different systems. Testing is absolutely crucial and practice, as true in data integrations as it for the trombone in high school, makes perfect.
The data integration will have two discrete phases: initial data population and ongoing updates. You need to test both thoroughly, which means you need both an AS/400 test instance and an easy way to request that the test instance is reset and copied down from production. This needs to be a simple request, because you will need to make it many, many times to keep hammering the integration layer as you refine and expand it, addressing issues and improving the logic.
This is an absolute must for the integration to be successful. If you can’t easily replicate production to test, you should not attempt to integrate Shopify Plus and the AS/400.
#5: Use database triggers
A database trigger is when you can have custom code run by the AS/400 any time a certain database action occurs. For example, if you want a product newly-added t to the AS/400 to appear in Shopify Plus, you have two options: You can have the integration layer check in with the AS/400 every few seconds and ask, “Are there new products”? This is called polling.
Alternatively, you can have the AS/400 notify the integration layer. “Hey, product 12 was just added—you might want to swing by and check this out.” This is called a webhook. When you use a webhook, your integration layer will turn around and gather all the information on the new product from the AS/400 and inject it into Shopify Plus via the Shopify Plus API.
One of the goals of using an integration layer is to minimize any changes that have to be implemented in the AS/400 itself. This helps reduce project risk. If you can use database triggers, you absolutely should, it’s a superior architecture (less error-prone and more efficient). If you can’t, polling will work fine.
#6: Use a message-oriented middleware approach
The fancy name for the integration layer is message-oriented middleware. All this really means is the integration layer is two things: business logic to move and transform data between two systems, bidirectionally, and a queue of tasks to be completed.
Why is using a queue important? Using a queue system approach ensures that when actions take place in the Shopify App or the AS/400, the notification of the event isn’t tied to the execution of the work required to deal with the action. This means that failures or outages in your business logic don’t cause the layer to miss that a new product was added, a new order was created, or any other important data-driven event occurred.
If you're looking at your existing AS/400 setup and future plans on Shopify Plus, hit us up and we'll give you a breakdown on your specific situation. Get in touch.
Drop us a line
Have a project in mind?
Contacting Third and Grove may cause awesomeness. Side effects include a website too good to ignore. Proceed at your own risk.