In previous article, we saw how to create BigCommerce store, application and how to integrate it with our Rails application. Now let’s create a simple Rails application which will interact with BigCommerce using its Rest API.

We have already added bigcommmerce-api-ruby gem for it. It’s an official Ruby client of Bigcommerce API. Our simple approach for this implementation is, when the load method is called from omniauth controller, we have store details in in params hash. We will use store params to find the store from the database and consider it as a current store throughout the user session.

We will create a method current_store in application controller to access the current store. Mark this method as a helper method so that we can access it in views as well. Each API call expects Oauth token and BigCommerce Client ID.

To fulfill this precondition, we will create a connection object first using the current store data and then we can use that connection object throughout the application to access the BigCommerce database.

Now, let’s create a products’ controller and fetch all products from current store. Here is a sample code to fetch all products from a store.

Make sure whenever you send a request to BigCommerce, connection object must be passed otherwise your request will be invalidated.

Here is the sample code to create a product on BigCommerce store.

To get the details of a single product, just pass product id with connection object.

To update a product, just pass product id with all product details you want to update and connection object.

Deleting product is again straightforward:

This way we can perform different operations with the help of available APIs. Please refer Github repository for complete code base.

We worked on a basic application for CRUD operations in this article. In next article, we will see what is webhook and how to handle it in BigCommerce. So keep reading!!

Click here for more blogs…


At BoTree Technologies, we build enterprise apps with our RoR team of 25+ engineers.

We also specialize in RPA, AI, Python, Django, Shopify, Spree commerce, NodeJS and ReactJS.

Consulting is free – let us help you grow!