# Sage 10 and roots/sage-woocommerce compatibility

**URL:** https://discourse.roots.io/t/sage-10-and-roots-sage-woocommerce-compatibility/17438
**Category:** sage
**Tags:** sage10
**Created:** 2020-01-15T21:33:15Z
**Posts:** 3

## Post 1 by @patrickv — 2020-01-15T21:33:15Z

Hello, I’ve being wroking on porting roots/sage-woocommerce to Sage 10 and so far it’s working out well except that I am stuck trying to find the proper way to handle a situation with one of the filter. If someone who knows better than me the api of sage or acorn, maybe they could point me in the right direction?

The `wc_get_template` filter in `roots/sage-woocommerce` returns and [empty view](https://github.com/roots/sage-woocommerce/blob/master/src/woocommerce.php#L62) if there’s a template found in the the theme files. How would `get_stylesheet_directory() . '/index.php'` be translated in Sage 10?

I assume I would like to do something like this and set an empty view, but I am not sure how to set a view like [this filter](https://github.com/roots/acorn/blob/master/src/Acorn/Sage/Concerns/FiltersTemplates.php#L40-L43) does by assigning it to `app['sage.view'] = ...` Something like `app('sage')->setView($view);` for example?

This is where I am stuck:

```
add_filter('wc_get_template', function ($template, $template_name, $args) {
        $name = WC()->template_path() . $template_name;
        $theme_template = locate_template(app('sage.finder')->locate($name));

        // return theme filename for status screen
        if (is_admin() &&
            ! wp_doing_ajax() &&
            function_exists('get_current_screen') &&
            get_current_screen() &&
            get_current_screen()->id === 'woocommerce_page_wc-status') {
            return $theme_template ? : $template;
        }

        // return empty file, output already rendered by 'woocommerce_before_template_part' hook
        return $theme_template ? get_template_directory() . '/index.php' : $template;
    }, 100, 3);
```

My repo with the other working filters is [here](https://github.com/ptrckvzn/sage-woocommerce/commit/e13de5b16936119dfa7aac49c658b18d3aff4d71).

I would be happy to submit a PR once I solved this.

I’d really like to use the view composer on my new project. Sage 10 looks so great! :slight_smile:

---

## Post 2 by @patrickv — 2020-01-17T22:08:52Z

Updated to includean empty template in the package itself. You would now need to add a namespace to Sage `config/view.php` file. Seems to work all right. :boom:

```
'namespaces' => [
        'SageWoocommerce' => get_theme_file_path('/vendor/roots/sage-woocommerce/src/resources/views'),
    ],
```

> **[ptrckvzn/sage-woocommerce](https://github.com/ptrckvzn/sage-woocommerce/tree/sage-10)**
>
> WooCommerce integration for Sage 9 themes. Contribute to ptrckvzn/sage-woocommerce development by creating an account on GitHub.

---

## Post 3 by @system — 2020-02-26T21:33:19Z

This topic was automatically closed after 42 days. New replies are no longer allowed.
