WooCommerce Uses single.php Instead of single-product.php: How to Fix It

WooCommerce uses single.php instead of single-product.php: how to fix it

You have a single-product.php template in your theme, but WooCommerce ignores it and renders product pages with the theme’s generic single.php. The reason is a missing declaration of WooCommerce support in the theme.

Problem: WooCommerce ignores the single-product.php template in your theme and uses single.php for product pages instead.

Solution: WooCommerce template overrides are enabled only for themes that declare WooCommerce support. Without the declaration, WooCommerce assumes the theme is not built for it and uses its “unsupported theme” mode: it renders the product inside the theme’s standard post template with a shortcode, so your own WooCommerce templates are never loaded.

Declare WooCommerce support

Add this to the theme’s functions.php:

add_action( 'after_setup_theme', 'helloadmin_woocommerce_support' );
function helloadmin_woocommerce_support() {
    add_theme_support( 'woocommerce' );

    // Optional: the product gallery features.
    add_theme_support( 'wc-product-gallery-zoom' );
    add_theme_support( 'wc-product-gallery-lightbox' );
    add_theme_support( 'wc-product-gallery-slider' );
}

Where WooCommerce looks for the template

With support declared, WooCommerce looks for the single product template in this order:

1. your-theme/single-product.php
2. your-theme/woocommerce/single-product.php
3. plugins/woocommerce/templates/single-product.php   (the default)

The woocommerce/ folder is the recommended place for overrides, because all of your WooCommerce templates stay together.

Override a WooCommerce template

To start from the default markup, copy the template from the plugin into your theme:

mkdir -p wp-content/themes/your-theme/woocommerce/
cp wp-content/plugins/woocommerce/templates/single-product.php wp-content/themes/your-theme/woocommerce/

NOTE: WooCommerce templates change between versions. After updating WooCommerce, compare your overrides with the new plugin templates. WooCommerce → Status lists the theme’s template overrides and marks the ones that are out of date.

Sources:

  1. https://wordpress.org/support/topic/single-product-is-using-single-php-not-single-product-php/
  2. https://github.com/woocommerce/woocommerce/wiki/Declaring-WooCommerce-support-in-themes