Create a test environment from a copy of your live shop

Use a copy of your shop to test changes, updates, and new features without affecting your live shop.

Pay attention to the app connections when you create the copy. Apps such as Shopware Payments are connected to your shop through a shop ID. A copy without staging mode can take over the app connections of your live shop. These apps then stop working in your live shop. Follow the steps below in the order given.

Set up the test environment

  1. Create the copy
    Set up the copy with its own domain and its own database. Then copy the files and the database of your live shop into it. The developer documentation explains how to do this in steps 1 and 2 of Creating the staging instance. To create the database dump, you can use the Shopware CLI.

  2. Adjust APP_URL
    Open the .env.local file in the root directory of the copy. Set APP_URL to the domain of the copy, for example:

    APP_URL=https://test.my-shop.com
  3. Verify APP_URL (from Shopware 6.7.17.0)
    Run this command on the copy:

    bin/console app:url:verify

    The command checks that APP_URL reaches the copy and not your live shop. If the check fails, correct APP_URL and run the command again. Only continue once the check passes.

  4. Activate staging mode
    Run this command on the copy before you open its Administration:

    bin/console system:setup:staging

    The command removes the app connections from the copy and gives it its own shop ID. This way, the copy can't affect the apps in your live shop.

You can then open the Administration of the copy and start testing. 

Shop ID dialog

If you open the Administration of the copy before step 4, a dialog about the shop ID appears. It appears because APP_URL has changed.

  • Choose Generate a new shop identifier. The copy gets its own shop ID, and your live shop is not affected.

  • Do not choose Keep the shop identifier. This option disconnects the apps in your live shop.

Then run step 4 to activate staging mode.

Further information

You can find technical details about staging mode in the developer documentation.

Was this article helpful?

0 / 1000 characters