Skip to content

How to configure units switcher?

Version available: 0.10.31+
Version 1.0.0 support: not supported

An ability to setup default measuring unit and to change measuring system from UI (metric or imperial).

Supported Units:

  • Metric: mm, cm, m
  • Imperial: in, ft

Setup:

  • Default unit: select default unit (from the list above)
  • Enable units switch: select secondary unit from another system

For config.json setup please refer to Config Options Documentation (search for defaultUnit and secondaryUnit).

Usage Notes:

  • Units for products setup (e.g. default product width/height) are the same as default unit for user.
    This means that the "default unit" is the unit you have used to setup products in the admin area / static .json files.

Integration Notes:

  • All measurements in services (save/quote) are in defaultUnit, regardless user choice
  • product.location.editableAreaUnits, product.editableAerSizes uses defaultUnit
  • How It Works Diagram: Draw IO schema (Open app for better scaling)
  • Available to preselect unit - use defaultProductAttributes.selectedUnit. Read more in Initial Options Documentation

Questions/Answers:

Q: Default unit is in, but I see ft in the ruler
A: Product size is upscaled/downscaled beneath measurement system to show at least 2 units.
Explanation screenshots:

Q: I have a list of product editable area sizes (product.editableAreaSize), will they work for both cm and in?
A: Yes. But for correct unit switcher please do not size labels:

Q: How to use step for product.location.editableAreaUnitsRange?
A: Configured step is not configured in units and this value is used for default and secondary unit. 

 

Migration Guide:

(upgrade from 0.10.29 and lower)
  • options.unit, options.unit2, options.unitConversionMult are deprecated but working
  • we recommend to replace options.unit with options.defaultUnit (if value suits Supported units)

Using Custom Unit:

  • This feature is not recomended, but working
  • Make sure that options.defaultUnit is not configured (it has higher priority)
  • Use options.unit with desired value (options.unit2, options.unitConversionMult are optional)
 

Feedback and Knowledge Base