Calculating amount of packages from square meters

Topic summary

A floor shop needs to implement functionality where customers can input square meters (m²) and the system automatically calculates the required number of packages.

Current Challenge:

  • Need to define package size (in m²) in the admin panel
  • This configuration should reflect in the shop frontend
  • When customers enter m² values, the system should auto-calculate package quantities

Example Use Case:

  • Entering “20” in the m² field should automatically calculate and display 8 packages

Reference:
A working example shop was provided (flottegulve.dk) that demonstrates this functionality.

Question to Community:
Seeking guidance on whether anyone has experience coding this type of setup or knows of existing solutions for this square meter to package conversion feature.

Summarized with AI on November 4. AI used: claude-sonnet-4-5-20250929.

We are looking to code setup for a floor-shop.
Here customers should be able to add amount of m2 (square meters) and from this input the system should automatically add amount of packages to field.
Example link on shop that has this setup:
https://flottegulve.dk/shop/19-plankegulve-med-lakeret-overflade/15141-plankegulv—boerstet-ask-prima-med-hvid-matlak—bredde-189-mm/?_gl=17yaais_up*MQ..&gclid=Cj0KCQjwxsm3BhDrARIsAMtVz6PRZnmZgs3MofSA6gyFBV6XxuddedM6uE2PKBjnSeThzJ7_X2o8PbsaAstWEALw_wcB
Try adding “20” in the M2 field - it will define 8 packages
So we somehow need to define package size (m2) in Admin and this should reflect in shop.

Anybody out there that has been working with code like this?

1 Like