Install extensions

This topic discusses how to install extensions, which can be any of the following:

  • Modules (extend Magento capabilities)
  • Themes (change the look and feel of your storefront and Admin)
  • Language packages (localize the storefront and Admin)

This topic discusses how to install extensions you purchased from Magento Marketplace. You can use the same procedure to install any extension; all you need is the extension's Composer name. To find it, open the extension's composer.json file and note the values for "name" and "version".

You must check in composer.lock to your environment; otherwise, the extension won't load in Magento Commerce (Cloud). That's because we run composer install (which uses composer.lock) and not composer update when we build and deploy the environment.

To install a extension, you must:

  1. Obtain the extension from Magento Marketplace or elsewhere.
  2. Get the extension’s Composer name and version from your purchase history.
  3. In your local Magento Commerce (Cloud) project, update the Magento composer.json file with the name and version of the extension.
  4. Push the changes to your environment.
  5. Verify the extension installed properly.

Get started

To get started:
  1. Log in to your local development system, or switch to, the Magento file system owner.
  2. Change to a directory to which the Magento file system owner has write access.
  3. Enter the following command in a terminal to log in to your project:

    magento-cloud login
  4. List your projects. With the project ID, you can complete additional commands.

    magento-cloud project:list
  5. If necessary, clone the project to your local. You should have cloned when setting up your local development workspace.

    magento-cloud project:get <project ID>
  6. Change to a project directory. For example, cd /var/www/html/magento2
  7. List environments in the project. Every environment includes an active Git branch of your code, database, environment variables, configurations, and services.

    magento-cloud environment:list

    magento-cloud environment:list displays environment hierarchies whereas git branch displays does not. If you have any nested environments, use magento-cloud environment:list to see the full list.

  8. Fetch origin branches to get the latest code:

    git fetch origin
  9. Check out, or switch to, a specific branch and environment. Git commands only checkout the Git branch. The Magento Cloud command also switches to the active environment.

    magento-cloud environment:checkout <environment ID>

    To create a new environment, use magento-cloud environment:branch <environment name> <parent environment ID>

  10. Pull any updated code to your local for the environment ID (which is the Git branch):

    git pull origin <environment ID>
  11. Create a snapshot of the environment as a backup:

    magento-cloud snapshot:create -e <environment ID>

Step 1: Get the extension’s Composer name and version

If you already know the extension’s Composer name and version, skip this step and continue with Update Magento’s composer.json.

To get the Composer name:

This section discusses how to get a extension’s Composer name and its version from Magento Marketplace. Alternatively, you can find the name and version of any extension (whether or not you purchased it on Marketplace) in the extension’s composer.json file. Open composer.json in a text editor and write down the values of "name" and "version".

To get the extension’s Composer name from Magento Marketplace:

  1. Log in to Magento Marketplace with the user name and password you used to purchase the component.
  2. In the upper right corner, click <your user name> > My Account as the following figure shows.

    Access your Marketplace account

  3. On the My Account page, click My Purchases as the following figure shows.

    Marketplace purchase history

  4. On the My Purchases page, click Technical Details for the extension you purchased as the following figure shows.

    Technical details shows the extension's Composer name

  5. Click Copy to copy the component name to the clipboard.
  6. Open a text editor.
  7. Paste the extension name in the text editor.
  8. Append a colon character (:) to the component name.
  9. In Technical Details on the My Purchases page, click Copy to copy the version to the clipboard.
  10. Append the version number to the component name after the colon.

    A sample follows:


Continue with the next section.

Step 2: Update Magento’s composer.json

Click to expand/collapse content

To update composer.json:

  1. If you haven’t done so already, change to your environment root directory.
  2. Enter the following commands to update it:

    composer require <component-name>:<version> --no-update
    composer update

    For example,

    composer require pixlee/magento2:1.0.1 --no-update
    composer update
  3. Enter the following
  4. Wait for project dependencies to update.
  5. Continue with the next section.

Step 3: Push the extension to your environment

To push the extension:

Enter the following commands in the order shown to commit your changes, including composer.lock:

git add -A
git commit -m "<message>"
git push origin <environment ID>

If there are errors, see extension deployment failure.

Step 4: Verify the extension

To verify the extension:

To verify the extension installed properly, you can check its functionality in the Magento Admin or you can make sure it is enabled as follows:

  1. SSH to the environment on which the extension is installed.
  2. Enter the following command to display a list of enabled modules:

    `php bin/magento module:status`
  3. Verify the extension is listed.

    The extension name is in the format <VendorName>_<ComponentName>; it is not the same format as the Composer name.