0

I´m making my first Woocommerce theme. In the documentation and in plugins/woocommerce/templates/single-product.php, it´s written :

This template can be overridden by copying it to yourtheme/woocommerce/single-product.php

But when I do this, it does not work and if I put the file on my theme root, it got it, why ?

Comments inside files and WooCommerce documentation are not updated ?

3
  • 2
    did you add add_theme_support( 'woocommerce' ); in your theme ? Oct 23 '19 at 17:45
  • 1
    @Chetan is correct. And single-product.php in the root theme folder works because that is a valid/recognized template for single posts of the product type - i.e. single-<post type>.php - and by default, it has a higher priority and would be used even if your theme does have woocommerce/single-product.php.
    – Sally CJ
    Oct 23 '19 at 18:37
  • @ChetanVaghela Thank you ! It´s exaclty what I wanted to know.
    – J.BizMai
    Oct 23 '19 at 19:24
1

As @ChetanVaghela said in comments, to use the woocommerce structure you need to add this code line :

add_theme_support( 'woocommerce' ); 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.