{"id":966,"date":"2020-04-28T12:30:19","date_gmt":"2020-04-28T12:30:19","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/2020\/04\/28\/change-quantity-without-clicking-update-button-in-mini-cart-in-magento-2\/"},"modified":"2025-05-22T13:24:25","modified_gmt":"2025-05-22T07:54:25","slug":"change-quantity-without-clicking-update-button-in-mini-cart-in-magento-2","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/change-quantity-without-clicking-update-button-in-mini-cart-in-magento-2\/","title":{"rendered":"How to Change Quantity Without Clicking Update Button in Mini Cart in Magento 2"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Earlier I posted a solution to&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/update-mini-cart-in-magento-2\/\" target=\"_blank\" rel=\"noreferrer noopener\">update mini cart in Magento 2<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Talking about user experience and mini cart, here\u2019s more it in this post.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The below solution allows users to change quantity without clicking the update button in mini cart in Magento 2.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The visitor can change the quantity of items in the text field and hit enter to update the mini cart without having to use the update button.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Reducing the number of clicks pushes conversion and that\u2019s what the below code helps to do:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Method to change quantity without clicking update button in mini cart in Magento 2:<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Open&nbsp;<em><strong>sidebar.js<\/strong><\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Place the below code at&nbsp;<strong>vendor\/magento\/Module_Checkout\/view\/frontend\/web\/js<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">    events['keypress ' + this.options.item.qty] = function (event) {\n        var keycode = (event.keyCode ? event.keyCode : event.which);\n        if(keycode == '13'){\n            $(this.options.item.qty + \"+\" +\" .update-cart-item\").click();\n        }\n    };<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That\u2019s it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Feel free to share the solution with Magento community via social media.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thank you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Earlier I posted a solution to&nbsp;update mini cart in Magento 2. Talking about user experience and mini cart, here\u2019s more it in this post. The below solution allows users to change quantity without clicking the update button in mini cart in Magento 2. The visitor can change the quantity of items in the text field [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34],"tags":[],"class_list":["post-966","post","type-post","status-publish","format-standard","hentry","category-magento"],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/966","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=966"}],"version-history":[{"count":2,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/966\/revisions"}],"predecessor-version":[{"id":14945,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/966\/revisions\/14945"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=966"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=966"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=966"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}