I added a text field Box in minicart that need to perform some calculation on keyup to update Qty.
I Added box field by modifying
module-checkout/view/frontend/web/template/minicart/item/default.html
Now I want to extend sidebar.js, To perform action on Knockout.js so that I update the Qty on keyup
module-checkout/view/frontend/web/js/sidebar.js
I am not sure how to do this.
I created a module and extended the sidebar.js in requirejs-config.js, its not working.
var config = {
map: {
'*': {
'Magento_Checkout/js/sidebar': 'new_ConfigProductDynamicName/js/sidebar',
}
}
};
I can see keyup of Qty to display update button in sidebar.js, I am not sure what will come at this.options.item.qty I am trying to do console.
events['keyup ' + this.options.item.qty] = function (event) {
console.log(this.options.item.qty);
self._showItemButton($(event.target));
};
How can I create a keyup function for the text field Box I created and perform action to update the Qty of that particular product in Mincart
Best Answer
you can follow below steps to solve the issue you have.
step 1: update Box input html in the file checkout/view/frontend/web/template/minicart/item/default.html as below.
step 2:
update your modules requirejs-config.js for mixins.
File : requirejs-config.js
step 3:
Please update the JS file for the js component 'new_ConfigProductDynamicName/js/sidebar'
File : sidebar.js
step 4: Now run below CLI command from your Magento root to clean static content and cache refresh