Skip to content

Instantly share code, notes, and snippets.

@tvlgiao
Created June 5, 2017 17:41
Show Gist options
  • Save tvlgiao/ddbabf4f70ab1360e559a8df69837aee to your computer and use it in GitHub Desktop.
Save tvlgiao/ddbabf4f70ab1360e559a8df69837aee to your computer and use it in GitHub Desktop.
[BigCommerce] Fix problem when it enter on quantity box it will decrease 1 unit
diff --git a/assets/js/theme/common/product-details.js b/assets/js/theme/common/product-details.js
index 7e97a13..e09f775 100644
--- a/assets/js/theme/common/product-details.js
+++ b/assets/js/theme/common/product-details.js
@@ -174,6 +174,20 @@ export default class Product {
// update text
viewModel.quantity.$text.text(qty);
});
+
+
+ // --------------------------------------------------------------------
+ // Giao - emthemesModez:
+ // Fix problem when it enter on quantity box it will decrease 1 unit
+ // --------------------------------------------------------------------
+
+ this.$scope.on('keypress', this.getViewModel(this.$scope).quantity.$input, (event) => {
+ if (event.keyCode === 13) {
+ event.preventDefault();
+ }
+ });
+
+ // --------------------------------------------------------------------
}
/**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment