Warning: You are browsing the documentation for PrestaShop 1.7, which is outdated.

You might want to look at the current version, PrestaShop 8. Read the updated version of the documentation

Learn how to upgrade to the latest version.


The TextWithUnitType represents text input with unit value (e.g. Kg, Cm & etc.).

Type options

Option Type Default Description
unit string unit Type of unit (e.g. Kg, Cm & etc)

Required Javascript components


Code example

Add TextWithUnitType to your form and optionally you can configure unit for it.


use Symfony\Component\Form\AbstractType;
use PrestaShopBundle\Form\Admin\Type\TextWithUnitType;

class SomeType extends AbstractType
    public function buildForm(FormBuilderInterface $builder, array $options)
        $builder->add('weight', TextWithUnitType::class, [
                'unit' => 'kg',
                'required' => false,
                'empty_data' => '0',

Preview example

TextWithUnitType rendered in form