Page 15 of 68

Magento 2 – How to Get Customer Data By Customer ID

In this post I am going to explain how to get customer data by customer id Magento 2. Using below code snippet you can get customer data by passing customer id. Add below code snippet in Block class. protected $_customerRepository; public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository, array $data = [] ) { $this->_customerRepository =…

Magento 2.4 Release! What’s New?

Great News for Magento Community! The latest version of Magento 2.4 is Release. Magento Open Source 2.4 includes a wealth of new features as well as hundreds of enhancements and fixes to the core product. What’s New in Magento 2.4? Every new release of Magento version comes with new features & improvements and gives better…

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/ <?xml version=”1.0″?> <config xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=”urn:magento:framework:Event/etc/events.xsd”> <event name=”payment_method_is_active”> <observer name=”custom_payment”…

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: <depends> <field id=”parent_field_id”>1</field> </depends> And to create a field dependant on two or more values, use the below code: <depends> <field…

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. protected $addressFactory; public function __construct( \Magento\Catalog\Block\Product\Context $context, \Magento\Customer\Model\AddressFactory $addressFactory, array $data = [] ) { $this->addressFactory = $addressFactory; parent::__construct($context, $data); } public function addAddress($customerId) { $firstName =…

15+ Domain Name Generators – Perfect Domain Name

Choosing a domain name isn’t easy. You want a website address that will be both memorable and meaningful while simultaneously describing what your brand is all about. Your domain name needs to make a good first impression. However, sometime when you find a catchy name that reflects your brand, the perfect domain might already be…

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: <div class=”field start_date”> <label class=”label” for=”start_date”> <span><?php echo __(‘Start Date’); ?></span> </label> <div class=”control”> <input id=”start_date” name=”start_date” title=”<?php echo __(‘Start Date’); ?>” class=”datepicker input-text” type=”text” value=””/> </div> </div> Add the below script to apply the date…

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. protected $storeManager; protected $customerFactory; public function __construct( \Magento\Catalog\Block\Product\Context $context, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Customer\Model\CustomerFactory $customerFactory, array $data = [] ) { $this->storeManager = $storeManager; $this->customerFactory = $customerFactory; parent::__construct($context, $data); }…

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. public function __construct( \Magento\Catalog\Block\Product\Context $context, \Magento\Framework\Data\Form\FormKey $formKey, array $data = [] ) { parent::__construct($context, $data); $this->formKey = $formKey; } public function getFormKey() { return $this->formKey->getFormKey(); } Add below code snippet in template…

Top 10+ Domain Name Register Websites

Domain Name Register Websites are the companies that allow you to purchase and register domain names. All websites, no matter how big or small, need a domain name. Domain names make the internet easy to use for everyone. No wonder that there are a sheer number of domain registrars companies but not all of them…

« Older posts Newer posts »