Skip to content

Allows variants to be sold as different sized cuts from a whole product.

License

Notifications You must be signed in to change notification settings

clomax/spree_flexible_variants

Repository files navigation

Build Status

SpreeFlexibleVariants

Allows variants to be sold as different sized cuts from a whole product. E.g. Fat/thin quarters, half metres, and metres from a bolt of fabric.

HowTo

Each product has the option, Flexible Variants, to sell variants at different sized cuts. The number of flexible units is the total number of the smallest size you can sell.

Example:

From a 10m bolt of fabric:

Size Units
Thin quarter 1
Fat quarter 1
Half metre 2
Metre 4

There are forty quarter metres in ten metres, therefore the total number of units is 40.

Turn off Spree's inventory tracking for each variant in the product.

Installation

Add spree_flexible_variants to your Gemfile:

gem 'spree_flexible_variants', git: 'git@github.com:clomax/spree_flexible_variants.git'

Bundle your dependencies and run the installation generator:

bundle
bundle exec rails g spree_flexible_variants:install

TODO

  • Add a way of setting unit amount for each variant - at the moment you have to do it in the DB

Testing

First bundle your dependencies, then run rake. rake will default to building the dummy app if it does not exist, then it will run specs. The dummy app can be regenerated by using rake test_app.

bundle
bundle exec rake

When testing your applications integration with this extension you may use it's factories. Simply add this require statement to your spec_helper:

require 'spree_flexible_variants/factories'

Copyright (c) 2015 Craig Lomax, released under the New BSD License

About

Allows variants to be sold as different sized cuts from a whole product.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published