Checkout: Trigger updates on country/region changes

You can create a mixin for Magento_Checkout/js/action/set-shipping-information and use that to add an event listener to the shipping address select fields (or any other field for that matter). Under you theme root folder create a requirejs-config.js file declaring the mixin The create the mixin file set-shipping-information-mixin.js under the declared Theme_Vendor/Theme_Name/Magento_Checkout/js/action folder with the following content:

Read more

How to make magento mobile menu collapse on all levels

By default, magento mobile menu is set to collapse only at the top level and not on all levels. To overcome this default feature one must override the _toggleMobileMode function that is implemented in the lib\web\mage\menu.js file.Overriding or extending javascript functionality in magento should be done using mixins. A mixin is a class whose methods are added to, or mixed in, with[…]

Read more

Minimize Magento downtime when deploying changes in production mode

Here are a few suggestions to minimize downtime on Magento, whenever you need to deploy changes in production mode. Changes on phtml template files in the child theme(no downtime) All templates are updated in folder var/view_processed (no need to delete it first) Changes in less, css, js files in the child theme(no downtime if css and js are served from[…]

Read more

How to hide/remove the Add to Cart button on magento 2

Sometimes it is useful to remove or hide the Add to Cart button throughout a magento 2 website. An easy way to do this without changing the actual template is by creating a plugin (also called interceptor) to change the isSaleable function that is used on those templates. Here I created the function that will be called after the isSaleable[…]

Read more