WordPress - Failing to override woocommerce templa

2019-09-20 03:10发布

问题:

I am trying to override Woocommerce's templates files by duplicating them in my custom theme directory / woocommerce / templates, but the changes don't appear (I tried simply adding classes to begin with) on the website. Is there something I am doing wrong ?

Thank you for your concern.

回答1:

While the directory structure in the WooCommerce plugin itself is:

/plugins/woocommerce/templates/

You should define it like the following in your theme (note the missing templates dir):

/yourtheme/woocommerce/

In other words, you should put all of the overrides directly within the woocommerce/ directory (there will be no templates/ directory). This is definitely confusing.



回答2:

make a Woocommerce folder inside the theme directory and then follow the folder structure symmetry as in the plugin for the fallback to work properly.

Hope it will work