5 Must Have Extensions for Your Magento 2 E-Commerce Store

Magento 2 is already very feature-rich. But, in terms of running a successful E-Commerce store, you might need to have some more features in your store for better user experience.

The best must-have Magento 2 extensions on your Magento eCommerce Store in 2019 now in one place, no need to search a lot on google. 

Here, we will list the best Magento 2 extensions which one every Magento eCommerce website needs. All extensions listed here are tested and fully compatible with Magento version 2. The most important things of Best 5 Magento 2 Must have Extensions are Free and Paid with high-quality extensions and reliable vendors in the Magento 2 marketplace.

Since the launch of Magento 2, several vendors have been developing and launching numerous Magento extensions. Some are free, some are paid. To help you get started, we present you our rundown of the best 5 must-have extensions for your Magento 2 store. The following list will help expand your e-commerce store’s functionality and attract new customers as well.

Magento 2 Out of Stock Notification

You don’t need to lose a client on the off chance that one of your store’s items is out of stock. Using this module, customers can subscribe to out-of-stock items. When you’re prepared to offer that item, a notification can be triggered to the customer. It can be done in both ways, automatic and manual.

GeoIP Store and Currency Switcher

If you offer your products in multiple languages or currencies, then this extension can be found very useful. You can configure the extension so that it can detect the frontend user’s location and then can automatically switch language/store based on the configuration done from the Admin panel.

Store Credit Extension for Magento 2.x

Magento 2 Store Credit extension by xMagestore is a powerful tool to increase customer loyalty and motivate customers. Store Credit extension significantly supports e-commerce stores to encourage customers’ purchases by awarding them credit amount which is automatically added to their account balance.

Twilio SMS Extension for Magento 2.x

You might need to send order updates via text message, or might need to verify the phone number of customer, in that case, this extension can be very useful. It uses Twilio API services, so to use this module, you will need to have an account on Twilio.

Alternatively, you can use some other extensions, if you want to use any other API service provider:

MSG91
Text Local

SEO Suite Ultimate Extension for Magento 2

SEO Suite Ultimate is a full-featured SEO solution that covers a full range of on-page SEO activities: from optimizing small page elements to building a well-thought site architecture.

Conclusion

We sincerely hope that you found our list of the must-have extensions for your Magento 2 e-commerce store helpful and educative. As you can see, there are numerous ways to fine-tune your store, reach more customers, and provide a pleasant shopping experience.

Create Customizable Options for products programmatically in Magento 2

Magento 2 is a popular CMS used widely used in eCommerce stores selling varied products.
Serving the options to customize the product the way customers to attract customers is a key success for any business. and Magento 2 allows you to do the same by creating multiple custom options from the admin side. Generally, These custom options are displayed on the eCommerce store front-end and allow your customer to customize the product as per the need of a set of different Custom options.
There are many Best Magento 2 Extension for eCommerce Store to Customizable the Product as his requirements.
In Magento 2 is offering a different event to create Customizable Options to products on the ‘checkout_onepage_controller_success_action’ event.

You can manually create custom options for the product by navigating the backend product edit page by using the Coding Technique.

Let’s dive deep into step by step process.

Creating a new module skeleton :

you need to create a new module for implementing (basically two files registration.php and module.xml files)

Vendor: Excellence
Module: GiftCard

registration.php (magento_root/vendor/module/registration.php)

<?php
    \Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Excellence_GiftCard',
    __DIR__
);

module.xml (magento_root/vendor/module/etc/module.xml)

<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
	<module name="Excellence_GiftCard" setup_version="1.0.0"/>
</config>

events.xml (magento_root/vendor/module/etc/events.xml)

Now here i am defining my observer to trigger on save after event of product.

<?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="catalog_product_save_after">
        <observer name="add_giftcard_custom_options" instance="Excellence\GiftCard\Observer\Adminhtml\GiftCardOptions" />
    </event>    
</config>

GiftCardOptions.php (magento_root/vendor/module/Observer/Adminhtml/GiftCardOptions.php)

Now I am observer file mentioned into the event file at a specified location to create pre-determined customizable options to create along with products.

<?php
namespace Excellence\GiftCard\Observer\Adminhtml;
use Magento\Framework\Event\ObserverInterface;
 
class GiftCardOptions implements ObserverInterface
{
    protected $_productOptions;
    protected $_productRepository;
    protected $_giftCardHelper;
 
    public function __construct(
        \Magento\Catalog\Model\Product\Option $productOptions,
        \Magento\Catalog\Model\Product $productRepository,
        \Excellence\GiftCard\Helper\Data $giftCardHelper
    ){
        $this->_productOptions = $productOptions;
        $this->_productRepository = $productRepository;
        $this->_giftCardHelper = $giftCardHelper;
    }
 
    public function execute(\Magento\Framework\Event\Observer $observer){
        $product = $observer->getProduct();
            $optionsStatus = $this->isOptionsExists($product);
            if(!$optionsStatus){
                $productId = $observer->getProduct()->getId();
                $productFromRepo = $this->_productRepository->load($productId);
                $values = [
                            [
                                'record_id'=>0,                                        
                                'title'=>'Gift Card',
                                'price'=>10,
                                'price_type'=>"fixed",
                                'sort_order'=>1,
                                'is_delete'=>0
                            ],
                            [
                                'record_id'=>1,                    
                                'title'=>'Gift Card',
                                'price'=>20,
                                'price_type'=>"fixed",
                                'sort_order'=>1,
                                'is_delete'=>0
                            ],
                            [
                                'record_id'=>2,                    
                                'title'=>'Gift Card',
                                'price'=>30,
                                'price_type'=>"fixed",
                                'sort_order'=>1,
                                'is_delete'=>0
                            ]
                ];

                $options = [
                            [
                                "sort_order"    => 0,
                                "title"         => "Gift Card Value",
                                "price_type"    => "fixed",
                                "type"          => "drop_down",
                                "is_require"    => 1,
                                "values"        => $values
                            ],[
                                "sort_order"    => 1,
                                "title"         => "Sender Name",
                                "price_type"    => "fixed",
                                "price"         => "",
                                "type"          => "field",
                                "is_require"    => 1
                            ],[
                                "sort_order"    => 2,
                                "title"         => "Sender Email",
                                "price_type"    => "fixed",
                                "price"         => "",
                                "type"          => "field",
                                "is_require"    => 1
                            ],[
                                "sort_order"    => 3,
                                "title"         => "Receiver Name",
                                "price_type"    => "fixed",
                                "price"         => "",
                                "type"          => "field",
                                "is_require"    => 1
                            ],[
                                "sort_order"    => 4,
                                "title"         => "Receiver Email",
                                "price_type"    => "fixed",
                                "price"         => "",
                                "type"          => "field",
                                "is_require"    => 1
                            ],[
                                "sort_order"    => 5,
                                "title"         => "Message",
                                "price_type"    => "fixed",
                                "price"         => "",
                                "type"          => "area",
                                "is_require"    => 0
                            ],[
                                "sort_order"    => 6,
                                "title"         => "Scheduled Date",
                                "price_type"    => "fixed",
                                "price"         => "",
                                "type"          => "date",
                                "is_require"    => 1
                            ]
                ];

                $productFromRepo->setHasOptions(1);
                $productFromRepo->setCanSaveCustomOptions(true);
                foreach ($options as $arrayOption) {
                    $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); //instance of Object manager
                    $option = $objectManager->create('\Magento\Catalog\Model\Product\Option')
                    ->setProductId($productId)
                    ->setStoreId($product->getStoreId())
                    ->addData($arrayOption);
                    $option->save();
                    $productFromRepo->addOption($option);
                }
                $productFromRepo->save();
        }        
    }
    
    public function isOptionsExists($product){
        foreach ($product->getOptions() as $value) {
            return true;
    }
        return false;
    }
}

The above file creates product customizable options along with product which can be visible under product customizable options tab.

Product Customizable Options View

You can also browse this product on store front to verify the same

Store Front View

Remove index.php from Magento Store URL

In this blog, we will see how to remove index.php from base URL of a Magento store.

To remove “index.php” from the web-site URL, the mod_rewrite module should be enabled on your server.

In case, mod_rewrite is not enabled, follow these steps:

  1. Run this command sudo a2enmod rewrite
  2. Edit your httpd configuration and write following lines
    &lt;Directory /var/www/&gt;
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
    &lt;/Directory&gt;
    
  3. Now, restart apache service using this command (the commands might change based on the OS that you use)
    sudo service apache2 restart

You need to following these steps:

  1. Log in to your Magento store admin and go to the Store ⇒ Configuration section. (In case of Magento 1, it’s System  Configuration)
  2. Then click on the Web tab in the leftside menu.
  3. Expand the Search Engines Optimization tab and set the Use Web Server Rewrites option to Yes.
    Search Engines Optimization
  4. Then, go to the Base URLs (Secure) tab and set the Use Secure URLs on Storefront option to Yes, too. Click on the Save Config button.
    Base URLs (Secure) ⇒ Use Secure URLs on Storefront
  5. Make sure your Secure and Unsecure base urls should end with “/”.

Magento 2 Console Command Sortcuts

While working on Magento 2.x, you often need to run several console commands which are actually very handy in terms of managing the things such as cache, upgrades, deploy modes, indexers etc. You can check the entire list of commands by running this command:

php bin/magento list

Well, typing the full long commands are not very pleasant if it has to be done multiple times. So, we can use shortcuts instead full commands. This feature comes due to the Symphony framework which is used by each console class that implement command line functionality. The use Symfony\Component\Console\Command component to implement command line features. You can learn more in the documentation of Symphony framework. You can use shortest unambiguous name intead of full name, e.g. s instead of setup.

Now, let’s see shortcuts for some of the commonly used Magento 2 console commands:

1. Cache Commands

php bin/magento cache:clean ==&gt; php bin/magento c:c

php bin/magento cache:disable ==&gt; php bin/magento c:d

php bin/magento cache:enable [cache_type] ==&gt; php bin/magento c:e [cache_type]

php bin/magento cache:flush [cache_type] ==&gt; php bin/magento c:f [cache_type]

php bin/magento cache:status ==&gt; php bin/magento c:s

Where cache_type is the parameter in which you can pass one or more cache types separated by whitespaces, e.g.

php bin/magento c:c config layout

2. Indexer Commands

php bin/magento indexer:reindex ==&gt; php bin/magento i:rei

php bin/magento indexer:info ==&gt; php bin/magento i:i

php bin/magento indexer:status ==&gt; php bin/magento i:sta

php bin/magento indexer:show-mode ==&gt; php bin/magento i:sho

php bin/magento indexer:reset ==&gt; php bin/magento i:res

You may pass parameters for particular indexer type as well.

3. Compile Command

php bin/magento setup:di:compile ==&gt; php bin/magento s:di:c

4. Setup Upgrade Command

php bin/magento setup:upgrade ==&gt; php bin/magento s:up

5. Static Content Deploy Command

php bin/magento setup:static-content:deploy ==&gt; php bin/magento s:s:d

6. Module Management Commands

php bin/magento module:status ==&gt; php bin/magento mo:s

php bin/magento module:disable Namespace_Module ==&gt; php bin/magento mo:d Namespace_Module

php bin/magento module:enable Namespace_Module ==&gt; php bin/magento mo:e Namespace_Module

php bin/magento module:uninstall Namespace_Module ==&gt; php bin/magento m:u Namespace_Module

How to create admin user using Command Line Interface | Magento 2

As you know a Magento Administrator can create a new user of any role from admin panel, but in some cases, one might need to create it from some other means rather than the conventional method (i.e. using Magento Admin Panel). E.g. if you forget admin login credentials, and you are unable to reset it by normal methods, then you will need some alternate way. This blog explains how you can add a new admin user using command line interface.

This is the command for adding new admin user:

php bin/magento admin:user:create --admin-user="username" --admin-password="password" --admin-email="[email protected]" --admin-firstname="First Name" --admin-lastname="Last Name"

You need to put proper information for username, password and email id and make sure neither username or email should be attached with existing admin users.

That’s all folks. You are all set to create new admin user using CLI.