In this post, I’m going to explain the approaches we can take to fetch products from Shopify store and display the same on our non-shopify based store.
Please read the first part of this post by clicking here
Considering, You’ve already read our first post now, I am going to discuss and give you a short snapshot of all the approaches we can take to get the products from Shopify stores and display on any non Shopify based stores.
CASE-1 (Default): All the Shopify stores have some sort of product feed URL’s and Collection based feed URL’s.
So, when you review these pages using the above URL’s, you will get XML formatted data of product feeds.
So, using file_get_contents, CURL or any other method we can hit and fetch xml format data from above url(s) and after parsing the received data, we can format it as per design and need, store it for further display on our on store. In order to manage the inventory, we have to set a cron job with a specific interval of time like 3 or 4 hours, on our script so that the inventory or other details can be synced with live store( please note that in this case we will be 3 or 4 hours behind as compared to original store information).
PROS: No need to perform update at any of the Shopify stores as we will use the default feed urls.
CONS: Limited product information available in feeds and we cannot do customization.
CASE-2: Create a custom collection or product feed with required attributes and fields, we can get extra information as per our requirement.
Simply, create a page and a page template along with snippet with basic store information and you’re done. The rest of steps are same as of CASE-1.
For more information, visit the following URLs
PROS: We can customize the attributes or fields we want in the feeds or we can say the information to display on our store easily.
CONS: We have to perform updates on all shopify stores which we’re integrating on our store.
CASE-3: Create Shopify Private API and use API details to fetch a bunch of data from orders to product information in JSON format.
Simple, create a private API using Shopify Backend “Apps” section and you’re done. This is the only update you need to do on the Shopify store from which you want to fetch the products.
When you’ve the Private API ready, you will get the URL structure like:
In above url, resource can be replaced with “collections” or “products” or “orders” to get desired result in JSON format.
**API Key and Password – Get it from the Shopify “apps” section
Now, simply use file_get_contents, CURL or any other method to hit the API URL and fetch json format data from there, parse the information as per your need, once the parsing is done, store in your own database of non shopify store and display it from there. Make a call to the API URL after certain interval of time (like you’re setting up a cron job for this) so as to sync the products information across two stores.
– Easy to configure on mulitple websites
– No need of any customizations at the Shopify end
– Data can be easily handled at other end (non shopify store)
Need to generate Private API key for store.
1. We have to make requests within certain interval of time in order to keep track of inventory.
2. There is a limit on the number of API calls to Shopify store
So, the final conclusion is, you can go for any approach out of 3 and see your requirements done.
Please share your valuable feedback and suggestions for further improvement.