4

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.

  • 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 '18 at 13:17
  • I am also facing the same issue after upgrading the magento to latest version(2.2.6). – Sunny Rahevar Nov 21 '18 at 10:36
1

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())) ?>"/>
| improve this answer | |
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

| improve this answer | |

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.