Magento2 How to add customer attribute
Magento 2.3 introduces the new way to modify data using Data and schema patches. To add customer attribute we will implement \Magento\Framework\Setup\Patch\DataPatchInterface. Create a class CustomerCustomAttributePatcher in your
Create Dynamic Custom Tabs on Product View Page
Today I’m creating new post on request from one of my fellow. He asked me how can we achieve dynamic multi tabs at product view page using best
Magento2 Create a Simple Module
Today I am going to demonstrate you how to create a basic custom module in magento2. Prerequisites : This tutorial assumes that you have installed magento with latest
Magento2 – How to load Quote by Quote id
Use \Magento\Quote\Api\CartRepositoryInterface Repository as a dependency to create its instance and load the quote using id. Alternatively you can also get quote using \Magento\Quote\Model\QuoteFactory model. But this has
Magento2 – How to get Current Url
To get url of the current page, the code below works everywhere: $objectManagerInstance = \Magento\Framework\App\ObjectManager::getInstance(); $url = objectManagerInstance -> get('Magento\Framework\UrlInterface'); echo $url -> getCurrentUrl(); From a .phtml template
Magento2 – How to get Directory of a Module
Here is the code how to load your module directory:
Magento2 – How to Get Country Name Using Country Code
Create Instance to Object Manager then inject dependency to perform your query: $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); Now load your country by the following code: While AE is the country
Magento2 How to Get Country Code Collection
To get country list data, you need to create instance of Country collection model `Magento\Directory\Model\ResourceModel\Country\CollectionFactory`. Once instance is created, you can load it by current store.