5

Step to reproduce

  1. Add product to cart
  2. Go to cart page
  3. Click on Edit item parameter. enter image description here

  4. Qty box value empty. enter image description here

Any help would be appreciated!Thanks.

2
  • This seems to be working fine, with default Magento 2.2.5 sample data. In the chrome browser. It is better if you share details like browser, Magento version, or if any customization done. It does takes a millisecond of time for the 1 to come up in qty box due to knockout may be.
    – Gagan
    Sep 13, 2018 at 13:17
  • I am also facing the same issue after upgrading the magento to latest version(2.2.6). Nov 21, 2018 at 10:36

4 Answers 4

3

You have to override the below path in your custom theme

Base file path :

vendor/magento/module-checkout/view/frontend/templates/cart/item/configure/updatecart.phtml

Move To Theme file path

app/design/frontend/<VENDOR_NAME>/<THEME_NAME>/Magento_Checkout/templates/cart/item/configure/updatecart.phtml

And add this below text in the input

 <?= $block->getProductDefaultQty() * 1 ?>

Exmple:-

<input type="number"
   name="qty"
   id="qty"
   min="0"
   value="<?= $block->getProductDefaultQty() * 1 ?>"
   title="<?= $block->escapeHtmlAttr(__('Qty')) ?>"
   class="input-text qty"
   data-validate="<?= $block->escapeHtml(json_encode($block->getQuantityValidators())) ?>"/>
0

Had the same issue. The main Reason was that js fired before the layout render. Check this file vendor/magento/module-checkout/view/frontend/web/js/view/configure/product-customer-data.js

productId = $(selectors.productIdSelector).val(),

This productId gets initial value null and after that is not reinitialized, which brakes the value population here.

if (!(data && data.items && data.items.length && productId)) {
    return;
}

We moved productId initialization to another function so it is reinitialized later when the view is rendered. Not a clear solution but it works

0

Same bug after upgrading a 2.1 to 2.4. They changed the product/view/form.phtml , adding this line :

<input type="hidden" name="item"  value="<?= (int)$block->getRequest()->getParam('id') ?>" />

Never forget to check changes in custom themes, even if it's a pain...

-1

In my case, I disabled extension "php bin/magento module:disable BoostMyShop_AdvancedStock" and stock issue resolved.

Thanks,

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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