Spree And Add Ons

We recently had a client who wanted the ability to upsell users additional content when they were in the checkout process. Being the lazy programmer I am, I immediately went to Google in search of the quickest solution possible. Unfortunately for me, the lazy solution eluded me. Devastated by my lack of an instant solution, I did the only reasonable thing I could think of: I wrote a Spree extension.

The wonderful people at Spree have some excellent documentation on how to create an extension, so I won’t repeat that here. Instead, I’ll just direct you to to our newest Spree extension: spree-add-on.

shopping cart with spree-add-on enabled

Like all Spree extensions, it’s very easy to install. Just add 'spree_add_on', github: 'freerunningtech/spree-add-on' to your Gemfile and run bundle exec rails g spree_add_on:install after a bundle install.

product sub-nav with spree-add-on enabled

Now you’ll be able to create add-ons for any of your products and upsell users during the checkout process. The extension also supports subclassing the Spree::AddOn class to hook in additional behaviour for specific types of add-ons. Keep an eye on our blog for a future post about the process behind doing so and in the meantime lets us know what you think of the gem. Pull requests are always welcome!