Allow enterprises to choose what available units for products/variants

What is the need / problem ?

With #5888 two new options (pounds and ounces) were introduced for product/variant units. The dropdown is now pretty big and could get bigger if we wanted to further support other units (many people in the US sell fruit by the pint or the quart), making it even more unwieldy to wade through a long list of options.

This would allow shops to ignore units that they never use.

Going further, we could also allow instances to choose the default available units for new shops on their instance (metric units only for most of the world, for example)

Who does it impact ?

All admin users

What is the current impact of the problem ?

It’s a little bit tedious to create products/variants and set their units.

What is the benefit of focusing on this ?

Speeds up a routine task

Potential solutions that will solve the problem ?

I was picturing long term having each enterprise able to choose from a list of units available (I was thinking a multi-tick-box UI, maybe even separated by imperial/metric). Then a shop could even choose to ignore units they never use, like grams or ounces. And also an instance could have in its configuration the default choices for a new shop on that instance. I think the behavior Luis describes is correct for what should happen if a product is in a unit that’s no longer in the list of units available - namely, nothing should happen until the user explicitly changes them.

Selection of a feature candidate

T-shirt size of our selected feature candidate

M (?)

Metrics to measure if need is satisfied after feature is implemented

Faster creation of products/variants

Feature owners

Epic/projet where you can follow implementation


Connected wishlist and discovery discussions*

I like where this is heading – in Canada, eventhough we are legally metric, many farmers sell in imperial. Or more complex still - some products are sold in metric (fluid measure - like milk) but others - like meat and cheese are sold in imperial. I’m just flagging some questions to mull over …
What would happen if farm A chooses to sell their beef by the kg, and farm B chooses to sell by the pound. They enter their products accordingly. Then down the line, they begin to expand their network in OFN (something we encourage) and they end up selling in the same market or ‘hub’. Does one of the farmers have change all their products? Would it be smart to think through a way that product units can be re-calculated automatically? Just pinging @Mario re network feature - maybe you’ve already thought about this, or maybe its not relevant. But its just in my mind.

Right now that idea of a hub with Farm A’s beef sold by the kg and Farm B’s beef sold by the pound works just fine - there’s no restriction on a hub (or farm) to only use one or the other. So farmers wouldn’t have to change their products, and as long as the hub doesn’t mind some beef sold in kg and other beef sold in lb, everything is peachy.

If an individual farm, right now, changes the units on a product (say beef) from kg to lb, and it has a variant that’s 1kg, that variant will automatically change to be 2.2 lb.

But I think there is indeed something that we could do further here for a hub, so that if a hub did want to have all its beef sold in kg, its suppliers could sell there and have their products automatically convert without having to change their products units on their end. But that would definitely require some design/inception thinking.

sorry for my tardy response - just want to say I’m so tickled with this feature - this is just A1. Thanks. Really for me, going even further is like icing on the icing ! I’d say lots of other things before this.

1 Like

This was added in Allow instances to choose available units for products/variants by andrewpbrett · Pull Request #6145 · openfoodfoundation/openfoodnetwork · GitHub