Tag: Magento 2 (page 1 of 24)

Magento 2 – How to Disable Payment Method Programmatically

In this post I am going to explain how to disable payment method programmatically in magento 2. First, We need to write the “payment_method_is_active” event, which checks on checkout for payment method availability. So, we are going to create event.xml file on below path. Path: app/code/Ht/Mymodule/etc/

Next to that, we are going to create…

Magento 2 – How to Add Dependant Field in Admin System Configuration

In this post I am going to explain how to add dependant field in admin system configuration in magento 2. In order to create a field dependant on single value, use the below code:

And to create a field dependant on two or more values, use the below code:

Here is the example…

Magento 2 – How to Add Customer Address Programmatically

In this post I am going to explain how to add customer address programmatically in magento 2. 1. Using Dependency Injection Add below code snippet in Block class.

  2. Using Object Manager  

  Thats it. Enjoy Magento 2!!

Magento 2 – How to Add Date Picker in Custom Form

In this post I am going to explain how to add date picker in custom form. Date Field HTML:

Add the below script to apply the date picker to the field.

Thats it. Enjoy Magento 2!!

Magento 2 – How to Create Customer Programmatically

In this post I am going to explain how to create customer programmatically in magento 2. 1. Using Dependency Injection Add below code snippet in Block class.

2. Using Object Manager

Note: After creating customer you need to run indexer command to see a customer in the backend grid.

That’s it. Enjoy…

Magento 2 – How to Add Form Key in phtml File

In this post I am going to explain how to add form key in phtml file. Add below code snippet in Block class.

Add below code snippet in template file.

The result is as below and you will find hidden form_key field inside the form.

That’s it. Enjoy Magento 2!!

Magento 2 – How to Unlock Reindex Process | HiddenTechies

In Magento 2, Sometimes an issue comes like the indexing process gets locked at the time of reindexing. When the process or the index type is locked then you cannot reindex that specific locked index type. The reindex will always skip that index type and you will get an error as below. “Index is locked…

Magento 2 – How to Get Region Id and Region Name By Region Code

In this post I am going to explain how to get region id and region name by region code in Magento 2. Use this below code snippet.

  Thats it. Enjoy Magento 2!!

Magento 2 – How to Remove Customer Account Navigation Links

In this post I am going to explain how to remove customer account navigation links in Magento 2. First you need to create one layout file “customer_account.xml” in your custom extension or theme. Syntax to remove link:

Here are list of links.

Thats it. Enjoy Magento 2!!

Magento 2 – How to Resize Product Image

In this post I am going to explain how to resize product image in Magento 2. Using the below code snippet you can resize the product image in the template (.phtml) file.

Thats it. Enjoy Magento 2!!

Older posts