If you don’t know about Spree, here is the brief introduction of it.

Spree Commerce Development is a complete, scalable, API-driven open source Ecommerce framework. Spree is a mature and market proven technology.

Spree is well suited to serve as a custom technology platform for any type of an Ecommerce web application: an online shop, a multi vendor marketplace, a rich-content driven commerce project, a social commerce website or a back-end engine for an Ecommerce mobile or tablet app (iOS, Android).

Spree has evolved at great extent with many good features. Recently, Spree has released version 3.6 which supports Rails 5.2, Ruby 2.5, ActiveStorage and Multistore Support.

Rails 5.2 support

Spree 3.6 is now compatible with Rails 5.2 compared to 3.5 which used to run on Rails 5.1. Now, you can start using all of the new great features available in Rails 5.2

ActiveStorage support

ActiveStorage was introduced in Rails 5.2 and with Spree 3.6 release it’s the default file storage option.

Ruby 2.5 support

Spree now works with Ruby 2.2 (>= 2.2.7), 2.3.x, 2.4.x and 2.5.x.It introduces many new features and performance improvements.

Multi-store support

Spree added support to create multiple store in single application. You can see all orders by particular store. Spree core team is still working on it to add more features and will ship it in upcoming release.

Now, let’s see how to create multiple stores in your Spree app!

First of all setup spree 3.6 by adding below gems to gemfile. I assume you have already created new rails app with Rails 5.2 and Ruby 2.5.

gem 'spree', '~> 3.6.1'
gem 'spree_auth_devise', '~> 3.3'
gem 'spree_gateway', '~> 3.3'

Run bundle install command and use below generators to set up Spree.

rails g spree:install --user_class=Spree::User
rails g spree:auth:install
rails g spree_gateway:install

This will ask to change Spree admin section email and password as it provides default email and password. This will also create sample data like products and orders.

Now, fire up rails s and visit localhost:3000 in your favourite browser and you can see your brand new spree store!

Spree 3.6 Store Front

Spree 3.6 Store Front

You can visit admin section by visiting localhost:3000/admin and can login with the default credentials you have noted while setup.

This is your default store and you can create multiple stores after login into the admin section. Click on Configuration > Stores link from left sidebar.

Create a new store from the top right corner

Create a new store from the top right corner, which will open a new form and ask for a store related information like name, url, code, etc. You can change your default store from stores listing page.

On orders listing page you can filter orders by store. When you create an order the current_store ID will be set in the order table. current_store is helper method which you can call in your controller and views to check current store.

There are two model methods available to check default store and current store.

Spree::Store.default
Spree::Store.current

This will return default store and current store record respectively.

This is all about new features available in Spree 3.6.

Thank You for reading!


Click here for more details…

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

We also specialize in Python, RPA, AI, Django, JavaScript and ReactJS.

Consulting is free – let us help you grow!