Forgotten Magento admin password?

No need to panic! If you have forgotten your Magento 2 admin password, you can create a new admin user from the command line (CLI). Go to your Magento 2 root directory and run:

After running the command (make…

CSS no longer loads (Magento 2)

Sometimes Magento 2 CSS files stop loading or are not displayed correctly. There are several possible causes, but running the following commands from the Magento 2 root directory will fix many of them:

Checking whether a product is in stock by product ID (Magento 2)

Use the following Magento 2 snippet to check stock availability by product ID:

Et voilà!

Loading a configuration value from the core_config_data table (Magento 2)

You may need to retrieve a value from Magento 2′s core_config_data table. This table typically stores configuration settings entered in the admin area. Use the following code to read the required value:

Reading a customer attribute (Magento 2)

Want to read a particular customer attribute in Magento 2? Use the following code to retrieve an attribute value for any customer by customer ID: