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

How to remove “Estimate shipping costs and tax” block from cart page in magento 2

To remove the “Estimate shipping costs and tax” block from the cart page: #1 Add the following code to checkout_cart_index.xml in your theme (create a new file if it doesn’t exist). The file should be in app/code/design/frontend/<Theme_Vendor>/<Theme_Name>/Magento_Checkout/layout/. #2 Override the template file checkout/cart/shipping.phtml in your theme (or module) and remove the following lines Then clear your cache and you are[…]

Read more

How to Disable Magento 2 Reviews And Ratings

You can easily disable magento 2 reviews and ratings functionality directly in the magento backend. Go to Stores > Settings > Configuration. Open the Catalog tab and choose the Catalog option. Navigate to the Product Reviews section and set No in the Enabled field. Save the changes. If you are running a version were you do not have that option then remove[…]

Read more

Add custom javascript to all pages on your theme

Use custom javascript The best solution to add custom javascript to all pages of your website is to create a javascript module and load it via requireJS. This can be done by creating a requirejs-config.js file in your theme folder with the following content: This file tells requireJS to load a custom.js file located in folder Theme_Vendor/Theme_Name/web/js. Include in that[…]

Read more

How to disable the dropdown in the minicart?

I had a customer that wanted to remove the minicart dropdown and take the visitor directly to the cart page when clicking the cart icon. This can be implemented by overriding the dropdown javascript module via mixin. First create a requirejs-config.js under your theme folder. You can add it inside the Magento_Checkout folder. So, create file Theme_Folder/Theme_Name/Magento_Checkout/requirejs-config.js with the following[…]

Read more

How to make phone number a mandatory field in contact page?

If you want to make the phone number a mandatory field in the contact page you will need to override the form.phtml template file. Copy the form.phtml template file used for your current contact form to the folder Magento_Contact/templates inside your theme’s folder. If your current theme does not have that template file it is inheriting from Magento luma or[…]

Read more