I am posting on “Using OFN” as I found this as a user in Portugal. We can move to product or tech if appropriate after we get better clarity over the topic.
Product Option Types is a spree feature that enables us to define dimensions in which the product can have variants, the spree guide examples are size and color.
Additionally to Option Types in OFN we added fields to the product model: variant_unit, variant_unit_scale and variant_unit_name.
It looks like this was done to create option types that are numeric (like weight and volume). These are much more common variant dimensions than color or size in OFN.
As far as I understand we have the menu and page to add product option types, but we don’t have a way to add these option types to the products directly.
Instead we have a static list of options (built in code of VariantUnitManager): g, kg, T, ml, L, KL and Items
In the database, we put this value in product.variant_unit and at the same time we create the option type for it AND we also create an option value for it based on what we input in the field “Value”.
So, as an example, when I create a new product with “Unit Size” "Volume (L) and value “1” I see in the database that this product gets a product.variant_unit = volume, an new option type is also created “unit_volume” and an option value of 1 is also created.
All this mixed up with the fact that two variants are immediately created for the new product: the master and the “standard” variant (the standard variant is created by OFN code) and both these variants get a variant.unit_value which ALSO comes from the input field “Value”, i.e., 1.
It’s definitely not easy to understand…
After VariantOverrides, this is the most “confusing” part of OFN code/model I know.
Are there related topics to this? I guess we need to clear this up or at least understand it