Spree extension for sharing variants across large numbers of products

Last updated on: February 24 at 08:53 PM

source code bug tracker request upgrade
0 0 0
0 / 0
owner:  bjornlinder

Custom Styles

In some use cases we may want to offer the same sets of variants for a large number of functionally equivalent products. Attempting to use the standard Spree store to support this can result in exponentially increasing numbers of variants. Here we introduce another model, CustomStyle, to supplement the Variant model. Customers choose a style for the product in the same way that they choose variants otherwise. Images associated with products are now accessed via the CustomStyle model.

Custom Styles is modeled after other Spree extensions. Comments and pull requests are welcomed.

** Additional Notes

Why 'Custom Styles'? Avoid potential name conflicts & differentiate from 'Style' in the application assets context.

Some additional coding would be needed to integrate with physical inventory.


The extension contains a rails generator that will add the necessary migrations and give you the option to run the migrations, or run them later, perhaps after installing other extensions. Once you have bundled the extension, run the install generator and its ready to use.

  <!-- rails generate spree_custom_styles:install -->

  bundle exec rake railties:install:migrations
  bundle exec rake db:migrate

Store coming soon!

See the extension in practice... also plan to add frontend views with custom styles to the gem.


No comments yet

Add article
compatible spree versions
tags spree versions
master >= 3.2.0, < 4.0
Bjorn Linder