solidus_backend gems offer a full-featured
customer-facing store and admin area for Solidus. They are not required to run
Solidus, but they offer comprehensive defaults.
You can override any frontend or backend templates by duplicating the view in
your project path. For example, if you wanted to duplicate the
, you can create the same file in your project:
You can choose to write the view from scratch or use and modify the original view. As with any Rails application, your app's views always override a gem's views if they have the same path and filename.
Rails generator for frontend overrides
If you want to override views from the
solidus_frontend gem, you can use the
provided Rails generator in your host application:
cd your-rails-project bundle exec rails generate solidus:views:override
This command creates copies of all of the frontend views, allowing you to customize them for your store.
If you only want to copy certain views into your host app, you can provide the
bundle exec rails generate solidus:views:override --only products/show
The argument to
--only can also be a substring of the name of the view from
the app/views/spree folder:
bundle exec rails generate solidus:views:override --only product
This copies all the views whose directory or filename contains the string "product".
Overrides and Solidus upgrades
Solidus views may change with each release. If you depend on view overrides, always test your application's views and read Solidus's changelog before upgrading in a production environment.
If you want to avoid upgrade difficulties, or you just need a tiny change to get feature you need, you can use the Deface gem . Deface dynamically changes your templates in-place.
However, if you use Deface extensively it can be tricky to find out where a particular piece of HTML actually comes from.
Solidus is an open source platform supported by the community. We encourage everyone using Solius to contribute back to the documentation and the code.