I need to disable the input field when customergroup = 0 or 1 and quantity is < 0 but when I add the argument 'disabled' to the input, the add2cart button does not put the other available items in the cart anymore.

   <input type="number"
                                       name="super_group[<?= $block->escapeHtmlAttr($_item->getId()) ?>]"
                                       data-selector="super_group[<?= $block->escapeHtmlAttr($_item->getId()) ?>]"
                                       value="<?= $block->escapeHtmlAttr($_item->getQty() * 1) ?>"
                                       title="<?= $block->escapeHtmlAttr(__('Qty')) ?>"
                                       class="input-text qty"
                                    <?php if ($disable_box === '1'  && ($block->getStockStatus($_item) == '1' || $block->getStockStatus($_item) == '0' )) {echo 'disabled';} ?> />

disabled inputboxes

2 Answers 2


The element with attribute disabled will not pass the value to form.

You can use readonly attribute instead of disabled or render additional element like <input type=hidded.../> for pass 0 value.


I have notice that, I have resolved it now like this:

  {echo 'readonly style="background-color:#D3D3D3;border-color:#D3D3D3;"';} ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.