Quickstart
Learn how to customize every part of the Spree stack
Spree is a very flexible platform allowing you to customize every part of it, to suit your business needs.
There are several ways you can achieve this:
There’s a lot of Store settings you can change in the admin panel without touching the code.
Changing currency, shipping zones, languages - it’s very easy to do.
Go to Admin > Configuration > General Settings
Global application configuration allows you to tweak Spree’s behavior without having to modify the source code.
Please see Preferences section for more information.
Spree allows you to use your own authentication system.
To do this, you need to create a new authentication system and configure Spree to use it.
You can find more information in the Authentication section.
With Spree you can change the checkout flow to fit your business needs.
Please see Checkout flow customization section for more information.
Spree allows you to swap core classes and services with your own, eg. you want to handle adding to cart differently.
In your config/initializers/spree.rb
file, you can set the following:
Spree::Dependencies.cart_add_item_service = "MyCartAddItemService"
which would use MyCartAddItemService
to handle adding to cart.
You can find more information in the Dependencies section.
Decorators allow you to add behavior to Spree classes in your application. We’re using a neat feature of Ruby language called Module.prepend to add the behavior to the model.
For example, to add a method that returns the product name in uppercase, you would add the following to your decorator:
module Spree
module ProductDecorator
def custom_name
name.upcase
end
end
Product.prepend(ProductDecorator)
end
Decorators should be used as a last resort. They can make upgrading Spree more difficult.
Please see Decorators section for more information.
Was this page helpful?