Google Tag Manager: Magento 2 Extension [FREE]

Google Tag Manager is a FREE Magento 2 Extension that allows you to integrate Google Tag Manager to your site. This extension also provides ecommerce transaction tracking feature. You just need to enter your Tag Manager container id in the extension’s configuration settings. This module is compatible with Magento version 2.0 and later. The Magento … Read more

Magento 2: Get Attribute Id, Name, Value from Attribute Code

This article shows how you can get attribute name or label, id, entity_type, etc. by attribute code in Magento 2. If you would like get attribute name and value in Magento 1 then you may refer to this article: Magento: How to get attribute name and value? I will be showing both Dependency Injection (DI) … Read more

Magento 2: Get Payment Methods (All/Active/Used)

This article shows how to get payment methods in Magento 2. We will be fetching 3 types of payment methods. They are: 1) All Payment Methods 2) Active/Enabled Payment Methods 3) Payment Methods that have been used while placing orders I will be showing both ways (Dependency Injection & Object Manager way) to get payment … Read more

Magento 2: Install via Composer and Command Line (CLI)

This article/tutorial show how to download and install Magento 2 through command line interface (CLI). We will be using Composer to download Magento 2 from Magento’s repository. Here is the step-by-step guide on installing Magento 2 via command line: 1) Check & Verify System Requirements Before, downloading and installing Magento 2, we need to make … Read more

Magento 2: Get Product’s Custom Option Value from Cart & Order

This article shows how to get custom option values of products/items added to cart or products of any order in Magento 2. I will simply be using ObjectManager for this example. Get custom options of products present in shopping cart $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $cart = $objectManager->get('\Magento\Checkout\Model\Cart'); // get cart items $items = $cart->getItems(); // get … Read more

Magento 2: Get all Categories of any/current Product

This article shows how we can get list of all categories from current product or any particular product as well. Both ways (Dependency Injection & Object Manager way) are shown below: Using Dependency Injection (DI) Below is a block class of my custom module (Chapagain_HelloWorld). I have injected object of \Magento\Catalog\Model\ResourceModel\Category\CollectionFactory, \Magento\Catalog\Model\ProductRepository and \Magento\Framework\Registry classes … Read more

Magento 2: Upgrade/Update using Command Line & Composer

This article shows how you can upgrade/update your Magento 2 version through command line using composer. Upgrading to Magento 2.3.x is a bit different than that of Magento 2.2.x or 2.1.x. At first, I will show the commands that need to be run to upgrade Magento2 to version 2.1.x or 2.2.x. Upgrading Magento to 2.2.x … Read more

Magento 2: Get all shopping cart items, subtotal, grand total, billing & shipping address

This article shows how to get shopping cart items/products, subtotal and grand total of cart, and shipping and billing address entered while doing checkout in Magento 2. I will be using both Dependency Injection (DI) and Object Manager in the below example code. Using Object Manager – Get products id, name, price, quantity, etc. present … Read more