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

How to change the default sort direction in category pages?

The best way to achieve this is by adding the following lines to the category pages layout file catalog_category_view.xml. This file can be under the Magento_Catalog\layout folder inside your theme folder. These instructions call the setDefaultDirection method in class Toolbar, and pass the value desc or asc to the argument dir. This sets the default sort direction to descending or[…]

Read more

How to change the order of tabs on the Product page?

The best way to implement the order change on the tabs that are displayed on magento’s product page is by extending the product page layout and changing the sort_order attribute for the tab block you want to move. In your theme’s folder (design/frontend/Theme_Vendor/Theme_Name) add (or append to) the file catalog_product_view.xml under the folder Magento_Catalog/layout. Is you already have that file[…]

Read more

How to show the totals section in the checkout shipping step

If you want to show the totals section when you first go to the default checkout in your magento 2 website you need to extend the abstract-total object defined in the Magento_Checkout/js/view/summary/abstract-total.js file. The function isFullMode needs to be replaced by a custom function that avoids not showing the total section in the shipping step. Basically the last statement on[…]

Read more

Randomize the product list in all categories

Recently I had a request from a customer asking to randomize the product listing in all the categories. The goal was to give the illusion of “freshness” or frequent changes in the categories. To achieve this the product collection created when a category is called needed to be sorted in a random order. I created an extension to override the[…]

Read more