Sage 9 + woocommerce

Hi Everyone,

First thank you for your great tool Sage 9.

After following the different instruction to add woocommerce in my sage project everything works find except variation product.

When I open a variation product page it looks great but when I change the select option nothing appens and the price doesn’t appear.

Looking for the source code I see that the variation.php (https://github.com/woocommerce/woocommerce/blob/master/templates/single-product/add-to-cart/variation.php) script is never added in my page.

My single-product.blade.php file look like :

@extends(‘layouts.app’)
@section(‘content’)
@php
woocommerce_content();
@endphp
@endsection

But when I add get_header( ); in my template like this :
@extends(‘layouts.app’)
@section(‘content’)
@php
get_header( );
woocommerce_content();
@endphp
@endsection

The variation product work fine but in the source code my headers are duplicated and the page show a notice like : header is require since 3.0.0
(in french : Notice: Thème sans header.php est obsolète depuis la version 3.0.0, aucune alternative n’est disponible. Veuillez inclure un modèle de header.php à votre thème. in C:\xampp\htdocs\leon\wp-includes\functions.php on line 3962)

head.blade.php file look like :

@php(wp_head())

And I use Blade 9.0.0-beta.3: April 21st, 2017

Thank you very much for your help :slight_smile:

get_header() looks for header.php in your theme folder, and if it doesn’t find it, you get the wp-includes/theme-compat/header.php file, which is what you’re seeing.

This is normal WordPress behavior. The way to resolve it is to either not use get_header() or add a header.php file to your theme.

See: https://github.com/WordPress/WordPress/blob/5fa2de51ef56cf6a3c1910e87d1657e0604f9643/wp-includes/general-template.php#L9-L42

I’m thinking this might work for your purposes, but it should be in header.blade.php:

do_action('get_header', 'shop');

Thank you for your response.

Meanwhile I found this solution from KimH : Sage 9 - Plugin scripts not enqueued?

KimH solution works, but as he says I don’t know if it introduce new issues.
I’ll try your solution in order to know if there is others solutions to my problem.

Thank you