Theme Development Overview
WooCommerce works seamlessly with WordPress themes, offering flexibility for both classic PHP-based themes and modern block themes. This guide introduces the fundamentals of WooCommerce theme development and helps you choose the right approach for your project.Theme Types
WooCommerce supports two distinct theme architectures, each with its own development paradigm:Classic Themes
Classic themes use PHP template files and hooks to render WooCommerce content. They’ve been the standard approach since WooCommerce’s inception. Key characteristics:- PHP-based template files (
.php) - Hook-driven customization system
- Located in
yourtheme/woocommerce/directory - Template overrides for custom layouts
- Direct control over HTML markup
- Existing WordPress sites with classic themes
- Projects requiring deep PHP customization
- Developers comfortable with WordPress template hierarchy
- Themes that need backward compatibility
Block Themes
Block themes leverage WordPress Full Site Editing (FSE) and use HTML-based block templates. Available since WordPress 5.9 and actively developed. Key characteristics:- HTML-based template files (
.html) - Styled via
theme.json(global styles) - Visual editing through Site Editor
- Block-based composition
- Modern CSS architecture
- New projects starting with WordPress 6.0+
- Visual, no-code customization requirements
- Modern development workflows
- Leveraging the WordPress block ecosystem
Theme Compatibility
As of WooCommerce 3.3+, all WordPress themes receive automatic compatibility with WooCommerce, even without explicit theme support. Templates render inside content areas maintaining your theme’s design.
Automatic Compatibility (No Theme Support)
Non-WooCommerce themes automatically include:- Product gallery features - Zoom, lightbox, and slider enabled by default
- Basic template rendering - Products and shop pages display in content areas
- Comments instead of reviews - Standard WordPress comments unless reviews are explicitly enabled
Declaring Theme Support
For advanced control, themes should declare WooCommerce support usingadd_theme_support():
Advanced Theme Support Options
Configure WooCommerce features when declaring support:thumbnail_image_width- Product thumbnail width (shop pages)single_image_width- Main product image width (single product)product_grid- Default, minimum, and maximum columns/rows for shop display
If image sizes aren’t declared, users can configure them via Customizer > WooCommerce > Product Images.
Product Gallery Features
WooCommerce includes an advanced product gallery with zoom, lightbox, and slider functionality using Flexslider, Photoswipe, and jQuery Zoom.Enabling Gallery Features
Disabling Gallery Features
If your theme provides custom gallery functionality:Integration Methods
WooCommerce offers three methods for integrating with themes:- Hooks (Recommended)
- Template Overrides
- woocommerce.php
The most flexible and upgrade-safe approach. Use hooks to inject theme markup around WooCommerce content.Advantages:
- Minimal maintenance on WooCommerce updates
- No template files to keep current
- Clean separation of concerns
Template Structure
WooCommerce templates reside in:/templates/ subdirectory.
All templates contain hooks allowing content addition/modification without editing template files. This is the preferred customization method.
Choosing Your Approach
Assess Your Project
- New sites: Consider block themes for modern development
- Existing classic themes: Continue with classic approach
- Client requirements: Visual editing favors block themes
Evaluate Technical Requirements
- Deep PHP customization: Classic themes
- Visual customization: Block themes
- Hybrid needs: Classic themes with Gutenberg blocks
Plan Integration Method
- Minor styling: Hooks only (recommended)
- Structural changes: Template overrides
- Complete control: Custom templates + hooks
Next Steps
Classic Theme Development
Learn PHP-based theme development with template files and hooks
Block Theme Development
Explore FSE, block templates, and theme.json styling
Theme Customization
CSS, hooks, child themes, and best practices