0

Hi I am focusing the Order Summary on my shopping cart, I found below file

/magento/module-checkout/view/frontend/web/template/summary/item/details.html

Inside above, there has a line of code, how does below works to grab the value?

<span class="label"><!-- ko i18n: 'Qty' --><!-- /ko --></span>

where should I start to check the code which generate qty of the items in the Shopping cart - order summary block?

Thanks

1 Answer 1

0

Check this file:

vendor/magento/module-checkout/view/frontend/web/js/view/configure/product-customer-data.js

/**
    * Updates product's qty input value according to actual data
    */
    updateQty = function () {

        if (productQty || productQty === 0) {
            productQtyInput = productQtyInput || $(selectors.qtySelector);

            if (productQtyInput && productQty.toString() !== productQtyInput.val()) {
                productQtyInput.val(productQty);
            }
        }
    },

    /**
    * Sets productQty according to cart data from customer-data
    *
    * @param {Object} data - cart data from customer-data
    */
    setProductQty = function (data) {
        var product;

        if (!(data && data.items && data.items.length && productId)) {
            return;
        }
        product = _.find(data.items, function (item) {
            if (item['item_id'] === itemId) {
                return item['product_id'] === productId ||
                    item['item_id'] === productId;
            }
        });

        if (!product) {
            return;
        }
        productQty = product.qty;
    };

    cartData.subscribe(function (updateCartData) {
        setProductQty(updateCartData);
        updateQty();
    });

    setProductQty(cartData());
    updateQty();
1
  • I delete the whole script, and the program still running. I have to idea where should start to debug from
    – Paul Fan
    Feb 1, 2020 at 0:58

Your Answer

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

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