WooCommerce & Sage 9 Blade Support

Oh snap, I think I know what I’m doing wrong. Does the composer require roots/sage-woocommerce have to run in a specific folder? I’m now running that in the {project_name/site} folder. I just noticed in @mejta 's example that he runs it in the {project_name/site/web/app/themes/theme_name} folder.

Hey, yes that is the problem. roots/sage-woocommerce is a dependency of Sage theme. If you install it as a bedrock dependency it won’t work.

1 Like

It works now! Have another question though. When I click on a shop item (in my case it’s a product-category) the page crashes with this message:

Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Call to a member function startSection() on null in /srv/www/{project_name}/current/web/app/uploads/cache/8c3128b400fa971dbd2c596b4bb67d4864d3b4c2.php

That didn’t happen before. Do you know what this might be?

The error you are mentioning is caused by @section directive. There are two types of templates that WooCommerce uses:

  1. page templates, e.g. archive-product.blade.php, single-product.blade.php
    Those templates have @secton('content') directive in there. You can identify those templates by looking into the WooCommerce plugin templates folder and any template that contains get_header() function call is a page template.

  2. partial templates
    They are included by calling wc_get_template_part or wc_get_template and those templates cannot have @section directive. Those templates are also called from page templates, so you can be sure that you have your layout as it should be.

1 Like

Ahhh makes sense, thanks! I removed the @extends directive now in my newly created taxonomy-product_cat.blade.php. For people running into this error: make sure to change wc_get_template_part('archive-product.php') into this: @include('woocommerce.archive-product').

1 Like

Have you tried this? Got some pretty awesome features:

This is a sage 9 theme fork

Fixed by https://github.com/roots/sage-woocommerce/pull/5

I confirmed the package sage-woocommerce is working. Update to 17, Mar 2019

I do not get the sidebar working. I also made a subfolder in my theme /woocommerce/global/sidebar.blade.php but stil no sidebar showing… Does anyone have an idea?

1 Like

Hi, @paulus005! I am experimenting with sage-woocommerce as well. I wasn’t too clear on how to get started. Stumbling along, but getting there :laughing:

Have you tried putting sidebar.blade.php in to the resources/views/woocommerce folder of your Sage theme?

Hi @silumesii,

Yes, I have tried this, but unfortunately no restult. :frowning:

Same problem in here, But I got the solution but i dont think this is the best practice. I added in resources/sidebar.php and it works. Still i dont know what is the best practice on this.