Question

I am currently starting to build a custom frontend for a Spree application and I was wondering how to go about it. I have read the Spree Commerce Documentation and it sais there are two ways of customizing views.

  • the Deface library
  • replacing the views in the Rails folder

In the docs it is stated that

Whenever you copy an entire view into your extension or application you are adding a significant maintenance overhead to your application when it comes to upgrading to newer versions of Spree. When upgrading between versions you need to compare each template that’s been replaced to ensure to replicate any changes from the newer Spree version in your locally copied version.

To this end we strongly suggest you use Deface to achieve the desired customizations wherever possible.

I would have to replace all of the front-end views but I am afraid that this will prevent me or others to update to another version of Spree. Defacing seems a bit overly complicated in my case...

Can anyone tell me how big of a problem replacing the views will be in regard of the above stated?

Was it helpful?

Solution

There are around 48 views in the front end of Spree. By replacing all of them in your own application, every tie you want to upgrade Spree, you will need to determine what has changed between your views, and Spree's views between the two Spree versions, check if any templates have been added or removed, and then figure out how to modify your views to conform to the expectations of a new version of spree. This will be a lot of work.

I'd recommend you re-evalute why you need to change all of Spree's views? Take a look at the spree_fancy extension. They are able to completely change the look & feel of Spree while only replacing a small subset of the views, and using Deface to add content and markup where needed. An extensions like this would be much easier to port to future versions of Spree than if they had replaced all of the views. We manage many Spree sites, and have several significantly customized front ends, and have not yet had to resort to techniques beyond Deface, and CSS changes.

If your front end is radically different, and using the existing Spree front end will be too cumbersome, you may want to consider building your front end using the Spree API. The API is designed to have more stable inputs and output between versions, which will make upgrading Spree much easier.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top