1

I want to know what JS file and where can I find the JS file that triggers the cart->delete. I'm using Magento 2.3 and upon searching I found a file in vendor/magento/module-checkout/Helper/Cart.php and it has the function getDeletePostJson which return the json_encode action and url. This action is located in vendor/magento/module-checkout/controller/cart/delete.php but I don't know which JS file calls this? and after calling this function what is the next step to this script? I'm trying to debug why upon deleting an item in the cart it's redirecting me back to the homepage eventhough I have a few more items in the cart

0

Its knockout js binding there

<a href="#" data-bind="attr: {'data-cart-item': item_id, title:
 $t('Remove item')}" class="action delete" data-cart-item="74398" 
title="Remove item">    
<span data-bind="i18n: 'Remove'">Remove</span></a>

and in minicart vendor\magento\module-checkout\view\frontend\web\js\shopping-cart.js

        $(document).on('ajax:removeFromCart', $.proxy(function () {
            reload = true;
            $('div.block.block-minicart').on('dropdowndialogclose', $.proxy(function () {
                if (reload === true) {
                    location.reload();
                    reload = false;
                }
                $('div.block.block-minicart').off('dropdowndialogclose');
            }));
        }, this));

and in checkout vendor\magento\module-checkout\view\frontend\web\js\sidebar.js

events['click ' + this.options.button.remove] =  function (event) {

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.