WooCommerce add-to-cart-variation.js not including
-
I’m using the newest Sage starter theme (version 9) from Roots and it comes with Laravel Blade templating engine.
So my problem now is that when I use single-product.blade.php to modify my product page layout it doesn’t load add-to-cart-variation.js when browsing variable products. So I’m unable to update price and stock qty based on selection.
Does anyone know what is the logic behind including that javascript or how the variable product is loaded?
Everything works as expected with the same markup if I use single-product.php instead of single-product.blade.php
base.blade.php
`<!doctype html>
<html @php language_attributes(); @endphp >@include(‘partials/head’)
<body @php body_class(); @endphp >
@include(‘partials/header’)
<main class=”main” role=”document”>
@yield(‘content’)
</main>@include(‘partials/footer’)
@php wp_footer(); @endphp</body>
</html>`single-product.blade.php:
`@extends(‘layouts.base’)
@section(‘content’)<section id=”single-product” class=”container”>
{{– Breadcrumbs –}}
@include(‘partials/breadcrumb’)@while ( have_posts() ) @php the_post(); @endphp
@php
wc_get_template_part( ‘content’, ‘single-product’ );
@endphp@endwhile
</section>
@endsection`
And here is the working single-product.php:
`<!DOCTYPE html>
<html>
<!– HEAD –>
<?php echo App\Template(‘partials/head’); ?><body <?php body_class(); ?>>
<!– HEADER –>
<?php echo App\Template(‘partials/header’); ?><!– CONTENT –>
<main class=”main” role=”document”>
<section id=”single-product” class=”container”><!– Breadcrumbs –>
<?php echo App\Template(‘partials/breadcrumb’); ?><?php while ( have_posts() ) : the_post(); ?>
<?php wc_get_template_part( ‘content’, ‘single-product’ ); ?>
<?php endwhile; // end of the loop. ?>
</section>
</main>
<!– FOOTER –>
<?php echo App\Template(‘partials/footer’); ?>
<?php wp_footer(); ?></body>
</html>`I have also tried to enqueue the script inside the theme functions.php but it doesn’t work (script is included but the variation selection does not update price nor stock quantity).
Any help is appreciated!
- The topic ‘WooCommerce add-to-cart-variation.js not including’ is closed to new replies.