Yo, let me tell you about a wild debugging session that had me questioning my entire WordPress existence. Picture this: A custom theme, built with modern tools like Rollup, looking clean AF… but WooCommerce’s cart page? Straight up ghost town. Empty. Nada. Here’s how we solved it.

The Setup 🛠️

I was rocking:

  • A custom WordPress theme built with Rollup
  • Modern JS with GSAP animations
  • SCSS compilation
  • WooCommerce for that ecommerce heat

Everything in my theme looked pristine. The setup.php was declaring all the right WooCommerce support:

phpCopyfunction swagdrip_woocommerce_setup() {
    add_theme_support('woocommerce');
    add_theme_support('wc-product-gallery-zoom');
    add_theme_support('wc-product-gallery-lightbox');
    add_theme_support('wc-product-gallery-slider');
}
add_action('after_setup_theme', 'swagdrip_woocommerce_setup');

The Problem 🤔

Hit the /cart URL and… nothing. Blank page. Header and footer showing up like they’re at a party they weren’t invited to, but the main content? MIA.

The Plot Twist 🌪️

Here’s where it gets interesting. After diving deep into WooCommerce’s template hierarchy (and questioning several life choices), turns out the issue wasn’t with WooCommerce at all. The problem? A missing page.php in the theme root.

See, WooCommerce isn’t some diva demanding custom templates for everything. It’s actually super chill and tries to work with your theme’s existing templates. When you hit that cart page, WooCommerce is like “Yo, I’ma just inject my content through the_content() hook in your basic page template.”

The Fix 💊

Added this minimal page.php to the theme root:

phpCopy<?php get_header(); ?>

<main id="primary" class="site-main">
    <?php
    while ( have_posts() ) :
        the_post();
        the_content();
    endwhile;
    ?>
</main>

<?php get_footer(); ?>

Boom. Cart content appeared like magic. No need for custom WooCommerce templates, no override needed, just the basic WordPress template hierarchy doing its thing.

The Lesson 📚

Sometimes the simplest solutions are hiding in plain sight. While we’re out here building custom themes with modern tools like Rollup, GSAP, and all that jazz, don’t forget the basics. WordPress’s template hierarchy is still the foundation everything sits on.

A few key takeaways:

  1. WooCommerce plays nice with default WordPress templates
  2. You don’t need to override WooCommerce templates for basic functionality
  3. Always ensure your theme has the basic template files (page.php, index.php, etc.)
  4. Modern build tools are dope but remember your WordPress fundamentals

What’s Next? 🚀

Now that the cart’s working, we can focus on the fun stuff – styling that bad boy up with some custom SCSS, adding smooth animations, and making it look as clean as the rest of our custom theme.

Remember fam, sometimes the biggest bugs have the smallest solutions. Keep it simple, respect the basics, and then go wild with the custom stuff.

Peace out! ✌️


Written by your favorite WordPress debugger who spent way too long on this before realizing the solution was this simple.