Magento: Programmatically Remove Layout Block

This article shows how you can remove layout blocks through the PHP Program instead of working in the layout.xml file in Magento 2. I will be using event observer. app/code/Company/Module/etc/frontend/events.xml <?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="layout_generate_blocks_after"> <observer name="remove_block" instance="Company\Module\Model\Observer\RemoveBlock" /> </event> </config> app/code/Company/Module/Observer/RemoveBlock.php Here, I am checking if a customer is logged in or … Read more

Magento 2: Images of old image gallery not showing in new media gallery

The new/enhanced media gallery was announced with the release of Adobe Commerce and Magento Open Source 2.4. Enable New Media Gallery STORES > Settings > Configuration > ADVANCED > System > Media Gallery Set Enable Old Media Gallery = No This will then enable the new media gallery. Access New Media gallery CONTENT > Media … Read more

Composer Update: Allowed memory size exhausted

When I run composer update, I got memory limit error: Fatal error: Allowed memory size of 2147483648 bytes exhausted (tried to allocate 167772160 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleSet.php on line 90 Tried solution from here: https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors Same error when I try: $ COMPOSER_MEMORY_LIMIT=-1 composer update Checked PHP memory limit: $ php -i | grep memory_limit memory_limit => … Read more

Magento 2: Recent Order not showing in Sales Order Grid

You place an order from frontend and expect it to be displayed in the Sales -> Orders grid in the Magento backend. But, you don’t see your recent order in the sales order grid. Cause This is because Magento uses Scheduled Grid Updates. The order related grids (order, invoice, shipment, credit memo) are updated via … Read more

Magento 2: Admin ERR_TOO_MANY_REDIRECTS

This article provides a solution to the redirect loop error while logging in to the Magento admin panel. Did set up an existing Magento shop. Went to the Magento admin login page Entered admin username and password Got the ERR_TOO_MANY_REDIRECTS error The website has a redirect loop ERR_TOO_MANY_REDIRECTS Cause The problem is with the Cookie … Read more