Reminder: If your theme integrates with external plugins make sure that they are available before trying to use them

The single most common, preventable, error type for themes in the previewer (and when a user first installs the theme) is attempting to use a missing function from a 3rd party pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the Plugin Directory or can be cost-based plugin from a third-party.

Calling a missing function results in a fatal error. At best the activation sandbox would catch and prevent activation and at worst it would result in fatal errors on the frontend, visible to the site visitors. Not a good thing for a visitor or the site.

You should always make sure that the dependency is available before calling functions from it. For example, if your theme has shop integration with woocommerse and you want to use the is_shop() conditional then make sure it is available before calling it.

$is_shop = function_exists( 'is_shop' ) && is_shop();

Making sure that functions, classes or files, when they come from external dependencies or systems, exist before using them in your theme is a good practice. It prevents errors and makes your code more robust.

If the function is not a conditional that returns a bool value then an alternative could be to shim the function. This is useful in some situations and not others. If you choose to shim functions I suggest you do it infrequently. An example of this would look something like this:

if ( ! function_exists( 'is_shop' ) ) :
    function is_shop() {
        //your codes goes here.