Reputation: 1115
I'm using Spree's 3-0 Stable Backend. I know that Master Variant get created after a new product gets created, but I cannot find the file/code where the Master Variant code gets triggered.
The resource controller had pretty generic create code and a redirect to the Product's url. Does anyone know where/how the Master Variant gets created?
Upvotes: 0
Views: 341
Reputation: 1115
Anddd, I found my own answer after posting. Funny how that works out.
For anyone in the future searching this, you have to look inside of the core gem rather than the backend. Variants get created after a Product gets created if the "option_values_hash" exists, which triggers the "build_variants_from_option_values_hash" method.
"Options_values_hash" and "build_variants_from_option_values_hash" can both be found at "spree/core/app/models/spree/product.rb ".
Upvotes: 1