Can anyone explain how the product qty in the input field in view/frontend/templates/cart/item/configure/updatecart.phtml is being pulled. This phtml file is used when you're trying to edit a product that is added to your cart. Below is the content of the said file.

 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.

/** @var $block \Magento\Catalog\Block\Product\View */
<?php $_product = $block->getProduct(); ?>
<?php $buttonTitle = __('Update Cart'); ?>
<?php if ($_product->isSaleable()) :?>
    <div class="box-tocart update">
        <fieldset class="fieldset">
            <?php if ($block->shouldRenderQuantity()) :?>
            <div class="field qty">
                <label class="label" for="qty"><span><?= $block->escapeHtml(__('Qty')) ?></span></label>
                <div class="control">
                    <input type="number"
                           title="<?= $block->escapeHtmlAttr(__('Qty')) ?>"
                           class="input-text qty"
                           data-validate="<?= $block->escapeHtmlAttr(json_encode($block->getQuantityValidators())) ?>"/>
            <?php endif; ?>
            <div class="actions">
                <button type="submit"
                        title="<?= $block->escapeHtmlAttr($buttonTitle) ?>"
                        class="action primary tocart"
                    <span><?= $block->escapeHtml($buttonTitle) ?></span>
                <?= $block->getChildHtml('', true) ?>
    <script type="text/x-magento-init">
            "#product_addtocart_form": {
                "validation": {},
                "addToCart": {
                    "cartButtonId": "#product-updatecart-button",
                    "cartForm": "#product_addtocart_form"
<?php endif; ?>

I can't see any scripts used to get the value or any PHP functions.

Your Answer

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

Browse other questions tagged or ask your own question.