Tag: Magento 2 (page 4 of 26)

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. $regionCode = ‘CA’; $countryCode = ‘US’; $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $region = $objectManager->create(‘Magento\Directory\Model\Region’); $regionId = $region->loadByCode($regionCode, $countryCode)->getId(); echo $regionId; $regionName = $region->loadByCode($regionCode, $countryCode)->getName(); echo $regionName;   Thats it. Enjoy…

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: <referenceBlock name=”link-block-name” remove=”true” /> Here are list of links. <page xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=”urn:magento:framework:View/Layout/etc/page_configuration.xsd”> <body> <!– Store credit –> <referenceBlock…

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. <?php $productId = ’12’; $_product = $block->getProductById($productId); $imageHelper = $this->helper(‘Magento\Catalog\Helper\Image’); $imgWidth = 350; $imgHeight = 400; $imageId = ‘category_page_grid’; $productImage = $imageHelper->init($_product, $imageId)…

How to Get Invoice Details by Invoice Id in Magento 2?

In this post I am going to explain how to get invoice details by invoice id in Magento 2. Using below code snippet you can get invoice details by passing invoice id. 1. Using Dependency Injection Add below code snippet in Block class. protected $_invoiceRepositoryInterface; protected $_logger; public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Sales\Api\InvoiceRepositoryInterface $invoiceRepositoryInterface, \Psr\Log\LoggerInterface…

How to Configure Cron in Magento 2

In this article we’ll show you, how to Configure Cron in Magento 2. Follow this simple guideline… Step 1: Get Started Login into Magento Admin Panel and from sidebar go to, Store > Settings > Configuration. Step 2: Configure Cron Now from sidebar, Go to Advanced > System. Now Expand Cron (Scheduled Tasks) section. Complete…

How to Optimize Resource Files in Magento 2

In this article we’ll show you, how to Optimize Resource Files in Magento 2. Follow this simple guideline… Step 1: Get Started Login into Magento Admin Panel and from sidebar go to, Store > Settings > Configuration. Step 2: Optimizing Resource Files Now from sidebar, Go to Advanced > Developer. To optimize CSS files, Expand…

How to add your IP Address to Whitelist in Magento 2

In this article we’ll show you, how to add your IP Address to Whitelist in Magento 2. Follow this simple guideline… Step 1: Get Started Login into Magento Admin Panel and from sidebar go to, Store > Settings > Configuration. Step 2: Add IP Address to Whitelist Now from sidebar, Go to Advanced > Developer….

How to Schedule Backups in Magento 2

In this article we’ll show you, how to Schedule Backups in Magento 2. Follow this simple guideline… Step 1: Get Started Login into Magento Admin Panel and from sidebar go to, Store > Settings > Configuration. Step 2: Schedule Backups Now from sidebar, Go to Advanced > System. Now Expand Backup Settings. Do the following….

How to Create Backup via Admin Panel in Magento 2

In this article we’ll show you, how to Create Backup via Admin Panel in Magento 2. Follow this simple guideline… Step 1: Get Started Login into Magento Admin Panel and from sidebar go to, System > Tools > Backups. Step 2: Create Backup In the upper-right corner, click the button for the type of backup…

How to Change Index Mode in Magento 2

In this article we’ll show you, how to Change Index Mode in Magento 2. Follow this simple guideline… Step 1: Get Started Login into Magento Admin Panel and from sidebar go to, System > Tools > Index Management. Step 2: Change Index Mode Mark the checkbox of each indexer that you want to change. Now…

Older posts Newer posts