//when a customer clicks 'Enter' button we submit the "add to cart" button (if visible) if (!Model.DisableBuyButton) { <script type="text/javascript"> $(document).ready(function() { $("#@Html.FieldIdFor(model => model.EnteredQuantity)").keydown(function(event) { if (event.keyCode == 13) { $("#[email protected]").click(); returnfalse; } }); }); </script> } }
You would create if/then/else condition to use the normal class on buy button if not disabled, and use your new hidden class if buy button is disabled.
I am trying to figure out how I can hide the Add To Cart button when the stock is 0, but it's not working.
It is default nopCommerce design to hide buy button if Low stock activity you set to disable buy button. To achieve this, you need to made small trick. If you set up stock = 0 it will not work. Set stock quantity = 1, and made test order. Creating order (if remember correctly) call action which run method chosen in low stock activity.
Please test it first on fresh nopCommerce installation without any external themes/plugins.