Notice: You are browsing the documentation for PrestaShop 9, which is currently in development.

You might want to read the documentation for the current version, PrestaShop 8. Read the current version of this page

DeltaQuantityType

Quantity field that displays the initial quantity (not editable) and allows editing with delta quantity instead (ex: +5, -8). The input data of this form type is the initial (as a plain integer) however, its output on submit is the delta quantity.

Type options

Option Type Default value Description

Code example

$builder->add('delta_quantity', DeltaQuantityType::class, [
    'required' => false,
    'label' => $this->trans('Edit quantity', 'Admin.Catalog.Feature'),
    'disabling_switch' => true,
    'disabling_switch_event' => 'combinationSwitchDeltaQuantity',
    'disabled_value' => function (?array $data) {
        return empty($data['quantity']) && empty($data['delta']);
    },
])

Preview example

DeltaQuantityType rendered in form example