0

I'm trying to find how to remove the qty box on the individual product options in bundles.

User doesn't have permission to edit the qty in these box and I want to remove them for a cleaner look.

Thanks!

1

You should not remove these forms from template instead hide these qty boxes using simple css, because these fields are in different element templates and you have to comment out in all files but for your ease and understanding i am putting down both methods :

Method 1 CSS :

using css just add this in your css / less file :

.bundle-options-container .nested .field.qty:last-child
{
    display : none;
}

Method 2 Changing in template(s) :

copy catalog/product/view/type/bundle/option/ folder from (/vendor/magento/module-bundle/view/frontend/templates/) and paste in your theme's Magento_Bundle/templates folder. there you can comment out qty box field html in all related element html file.

like in radio.phtml file comment this block :

<div class="field qty qty-holder">
            <label class="label" for="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>-qty-input">
                <span><?= /* @escapeNotVerified */ __('Quantity') ?></span>
            </label>
            <div class="control">
                <input <?php if (!$_canChangeQty) echo ' disabled="disabled"' ?>
                       id="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>-qty-input"
                       class="input-text qty<?php if (!$_canChangeQty) echo ' qty-disabled' ?>"
                       type="number"
                       name="bundle_option_qty[<?= /* @escapeNotVerified */ $_option->getId() ?>]"
                       data-selector="bundle_option_qty[<?= /* @escapeNotVerified */ $_option->getId() ?>]"
                       value="<?= /* @escapeNotVerified */ $_defaultQty ?>"/>
            </div>
      </div>

So if you compare both methods , i would suggest css method since it is easier.

NOTE : after making any front end changes deployment deploy your static content ( php bin/magento setup:static-content deploy -f ) and clear cache ( php bin/magento cache:flush )

  • I was successful with your method 1, Thanks! If I want to use the method 1 cssthis time to hide the price-notice (+$X.XX) in the bundle option what should I write? – Emili May 8 at 17:48

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.