How to test if a Magento store is in "Demo Mode"

How to test if a Magento store is in "Demo Mode"

September 8, 2026 · Illustrated author avatarBy Stefan Bogdanescu
How to test if a Magento store is in "Demo Mode"

Testing Magento Demo Mode Status: A Developer’s Guide

As a Magento developer, you may find yourself needing to check if your store is currently operating in “Demo Mode.” This mode serves as an alert for visitors that orders will not be fulfilled. It’s crucial to ensure your checkout process remains functional unless specifically disabled during this period.

Understanding the Demo Mode Configuration

Magento enables demo mode through the configuration file app/code/core/Mage/Core/etc/config.xml. The relevant node is <demo>:

<config>
  <global>
    <demo>
      <active>1</active>
      <title>DEMO MODE: This is a Magento Demo Store.</title>
      <description>All prices are in demo currency and do not include tax or shipping costs. No orders will be fulfilled.</description>
    </demo>
    ...
  </global>
  ...
</config>

The <active> node determines if the store is in demo mode (1 for active, 0 otherwise). The <title> and <description> nodes specify the banner text.

Checking Demo Mode Status Programmatically

To test if a Magento store is currently in demo mode programmatically, you can access the configuration value. Here’s an example:

$demoMode = Mage::getStoreConfig('global/demo/active');

If $demoMode equals 1, the store is in demo mode.

Disabling Checkout for Demo Mode

To disable the checkout process when demo mode is active, you can modify your template files. As an example, let’s look at the template/persistent/cross-sell.phtml file:

<?php if ($this->getItems() && !$demoMode): ?>
  <!-- Your cross-selling products go here -->
... <?php endif; ?>

In this snippet, we use the ternary operator to check if demo mode is enabled ($demoMode). If it is, the checkout process remains hidden regardless of product availability.

Best Practices and Recommendations

Remember that testing for demo mode should be done at runtime, not compile-time. This ensures you capture any changes made through the Magento admin interface before deploying your code.

Also consider adding a custom module with an observer for controller_action_predispatch_checkout_index_index event to hook into the checkout process directly and disable it when necessary:

<config>
  <global>
    <events>
      <controller_action_predispatch_checkout_index_index>
        <observers>
          <disable_demo_mode_checkout>
            <class>your_module/observer</class>
            <method>disableCheckout</method>
          </disable_demo_mode_checkout>
        </observers>
      </controller_action_predispatch_checkout_index_index>
    </events>
  </global>
</config>

The observer method disableCheckout can then check the demo mode status and redirect users away from the checkout if necessary.

Conclusion

Testing your Magento store for demo mode status is straightforward once you understand the configuration. By leveraging Magento’s built-in configuration accessor, you can easily check the demo mode flag within your templates or custom observers.

Remember to always test your changes thoroughly in a staging environment before deploying them to production. Keep an eye on our blog at Laravel Company for more Magento development tips and best practices!

Happy coding!

Checkout Themes Configuration Orders

Our network