Optional - Install sample data

If you need some example data when developing your store, you can install our sample data. This data simulates an active Magento store including customers, products, and other data. This sample data works best with a new “blank site” Magento Commerce Cloud template installation when creating your project in your Integration environment.

We recommend installing sample data in your local Integration branches and environments. If you use this data in Staging or Production, you need to remove the information and products before going live.

Get started in a branch

We recommend working in a branch to add the sample data. The following information details how to set up a branch.

To get started with environment branches:

  1. On your local workstation, change to your Cloud project directory.

  2. Switch to the Magento file system owner.

  3. Log in to your Magento project.

    1
    
    magento-cloud login
    
  4. List your projects.

    1
    
    magento-cloud project:list
    
  5. List environments in the project. Every environment includes an active Git branch that contains your code, database, environment variables, configurations, and services.

    1
    
    magento-cloud environment:list
    

    It is important to use the magento-cloud environment:list command because it displays environment hierarchies, whereas the git branch command does not.

  6. Fetch origin branches to get the latest code.

    1
    
    git fetch origin
    
  7. Checkout, or switch to, a specific branch and environment.

    1
    
    magento-cloud environment:checkout <environment-ID>
    

    Git commands only checkout the Git branch. The magento-cloud checkout command checks out the branch and switches to the active environment.

    You can create a new environment branch using the magento-cloud environment:branch <environment-name> <parent-environment-ID> command syntax. It may take some additional time to create and activate a new environment branch.

  8. Use the environment ID to pull any updated code to your local. This is not necessary if the environment branch is new.

    1
    
    git pull origin <environment-ID>
    
  9. (Optional) Create a snapshot of the environment as a backup.

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

Install sample data

To install sample data:

  1. If you have not done so already, check out the environment in which to install sample data.
  2. In a terminal, enter the following commands:

    1
    
    <magento_root>/bin/magento sampledata:deploy
    
  3. Wait for components to update.
  4. Commit and push the changes:

    1
    
    git add -A && git commit -m "Install sample data"
    
    1
    
    git push origin <branch name>
    
  5. Wait for the project to deploy.
  6. Verify the installation was successful by going to your storefront main page in the Integration environment. You can locate the URL link to the storefront through the Project Web Interface.
  7. Take a snapshot of your environment:

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

You can start testing your development with live data!