Magento2

Magento2 – How to load Quote by Quote id

By Using Object Manager you can inject the instace of \Magento\Quote\Model\QuoteFactory The other and recommended way, you can load the
Posted in Guides, Magento Questions, Quote & Orders | Tagged , , , , , , | 2 Comments

Magento2 – How to get Store Name

To get store name you need instance of \Magento\Framework\App\Config\ScopeConfigInterface You can get the instance by objectManager. Use the following code
Posted in Guides, Magento Questions | Leave a comment

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’);
Posted in Guides | 2 Comments

Magento2 – How to get Directory of a Module

Here is the code how to load your module directory: $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $directoryReader = $objectManager->create(‘\Magento\Framework\Module\Dir\Reader’); $moduleDirectory = $directoryReader->getModuleDir(”, ‘Knowthemage_Hello’);
Posted in Guides, Modules | Leave a comment

Magento2 – How to get Current locale Programmatically

Inject Resolver Dependency and get locale in your phtml And in your phtml:
Posted in Countries & Addresses, Guides | 3 Comments

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
Posted in Countries & Addresses, Guides | Leave a comment

Magento2 How to Get Country Code Collection

Fortunately magento2 introduces many ways to get data from collection. Here we are following from those of two approaches :
Posted in Countries & Addresses, Guides | Tagged , , | Leave a comment