WooCommerce & Sage 9 Blade Support


#21

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.


#22

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.


#23

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?


#24

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.


#25

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').


#27

Have you tried this? Got some pretty awesome features:

This is a sage 9 theme fork


#28

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