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.
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.
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.
Add spree_flexible_variants to your Gemfile:
gem 'spree_flexible_variants', git: '[email protected]:clomax/spree_flexible_variants.git'
Bundle your dependencies and run the installation generator:
bundle
bundle exec rails g spree_flexible_variants:install
- Add a way of setting unit amount for each variant - at the moment you have to do it in the DB
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