Roots Discourse

WooCommerce support for Sage 10

As I can not reply to the multiple already closed topics, I am opening another one:

I’ve forked and overworked sage-woocommerce for Sage 10 support. Plesase feel free to give it a try:

As WooCommerce is on the list of native support for Sage 10, I am looking forward to a final and propably more robust solution. So take it as a temporary fix.

8 Likes

This package have some problems. First of all:

When you’re in shop category it tries to load taxonomy-product_cat.php and if you don’t have such file error will be triggered, it should try to load archive-product.blade.php instead.

Another big one: wc_get_template( 'archive-product.php' ) loading twice. One from Woocommerce plugin template and one from theme, so in the end you have duplicate products rendered.

Thanks for your feedback @RomkaLTU .

As you mention it I remember that even with Sage 9 it was required to add a taxonomy-product_cat.blade.php and taxonomy-product_tag.blade.php to the template structure. I will add both files and a notice to the repo.

As I am am using Blade @include() instead of wc_get_template(), I did not recognize that.
Can you please verify that uncommenting line 75 (echo view($view, $data)->render();) fixes it for you?

Seems we both synchronized our work on the same day but with different solutions :slight_smile: https://github.com/generoi/sage-woocommerce

Mine is very untested though

1 Like

Another one: https://github.com/ptrckvzn/sage-woocommerce
Haven’t had any issue so far.

Hi @patrickv,

I could be doing something wrong, but using composer require roots/sage-woocommerce gets the sage 9 version.

I manually downloaded the sage 10 ZIP and replaced the files in vendor/roots/sage-woocommerce and it works like a charm.

This is absolutely the worst practice ever - would you be so kind as to guide me on how to composer require the sage 10 branch, please?

Thank you so much and sorry for the trouble.

Regards,
Sam

The roots/sage-woocommerce package explicitly states it supports only Sage 9: https://github.com/roots/sage-woocommerce#woocommerce-integration-for-sage-9-themes

The package @patrickv linked to is a different package. You would need to install that different package to use it. It doesn’t look like it’s published on Packagist, so you would need to configure composer to install it from git: https://getcomposer.org/doc/05-repositories.md#vcs

1 Like

Ah yes! There was a neuron trying to fire somewhere in my brain coz that’s what I do for ACF.

Thank you so much for your help, sir, very much appreciated.

1 Like

Not wanting to start another thread for Woo/Sage 10 and you always seem to have very sound advise. I’m a long time Roots/Sage/Woo user but am struggling to get 10 running with Woo. I’ve tried all the packages I’ve found through the threads but am getting errors.

I need to know if I should move back to Sage 9 with Woo or if there is anyone that has gotten it working with 10 without crazy effort. I’m also scared because I will also be running Woo Subscriptions and would hate to find myself down a rabbit hole after a bunch of work.

Hola! I am currently building out my first woocommerce site and am using sage 10. I’ve of course have run into a few snags with compatibility since there isn’t a

The solutions I’ve tired are listed below:
ouun/stage-woocommerce
ptrckvzn/sage-woocommerce

Both seem to work for basic customization however I have to dig a little deeper and change the tabs template. Tabs template

I’ve created the template file tabs.blade.php to override the template file:
theme/woocommerce/single-product/tabs/tabs.php

Using either of the above solutions I get the same error.

ErrorException (E_ERROR)
Unrecognized extension in file: SageWoocommerce::empty. (View: /srv/www/theme.com/current/web/app/themes/theme/resources/views/woocommerce/single-product.blade.php)
Previous exceptions
Unrecognized extension in file: SageWoocommerce::empty. (0)

throw new InvalidArgumentException("Unrecognized extension in file: {$path}.");

Going to switch over to generoi/sage-woocommerce and give it a try but was wondering if anyone had any insight on this error.

Do open a bug report in the github repository if it doesn’t work

I wasn’t able to use it. I didn’t know what you meant in the readme file in terms of the setup. I actually defaulted back to ptrckvzn/sage-woocommerce It turns out I needed to add an empty.php file to views in order to get the nested woocommerce template to work. That removed that error.

I came to that conclusion with colleagues and not on my own.

1 Like

Use this package smarteist/sage-woocommerce for sage 10,
I’ve tested and i`m looking forward to your suggestions and contributions.

1 Like

Hello @MikaCaldera, replying a bit late :sweat_smile:, but there’s an extra step to add the path of the extension view folder to your theme config so that it can find the empty.php view.

To quote the documentation:

Add package path to Sage view namespaces in config/view.php :

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

I hope that works!

I am trying your package in a complex woocommerce site and it’s working beautifully so far. Thanks for your effort!
I love the integration and scaffolding with acorn.

I tried both @MikaCaldera / @patrickv with no success, but it was probably my fault as I had some errors coming from sage9 site that I had fixed when swapping composer packages.

What I can say, though, is that running composer require "mikacaldera/woocommerce-sage-10" didn’t work for last sage 10 (@dev). It gave this error:

Could not find a matching version of package mikacaldera/woocommerce-sage-10. Check the package spelling, your version constraint and that the package is available in a stability which matches your minimum-stability (dev)

Hi @SergiArias,

¿have you tried this one? I’m using it and it works like a charm so far:

3 Likes

Hi @carlosfaria,

I didn’t, I went directly with smarteist one, as I saw it is more Sage 10 focused. It works wonderfully so far, but I will give it a try to the generoi one as well, as it has more stars in github and it follows same philosophy as the smarteist one.

Thanks for the recommendation!

By the way, the one from smarteist is based on generoi’s one, solving some problems according to the author which I contacted recently:

it doesn’t override the woocommerce template pages. Also “wc-status” page in admin panel doesn’t show overridden templates.

So for now, for the newcomers seeing this post I would heavily recommend smarteist one unless generoi gets updated:

smarteist/sage-woocommerce

2 Likes

As I see a lot of people is following my advice of using smarteist version of woocommerce, I have to recommend again generoi version as it solved all the issues that I was referring to, and I think it’s a more solid solution.

generoi/sage-woocommerce

1 Like