问题
I'm using a Woocommerce based plugin called Mix 'n Match Products.
This plugin sits inside /plugins/woocommerce-mix-and-match-products/
This folder contains another folder for templates.
Following convention, I have copied the "templates" folder into my child theme and changed the folder name to "woocommerce-mix-and-match-products"
The structure is now themes/storevilla-child/woocommerce-mix-and-match-products/
However, none of the templates override the plugin templates. I have tested. Only once I change the actual plugin template files, does the HTML change.
Can anybody spot what I may be doing wrong?
Thanks
回答1:
The way to do it is a little bit different. All WooThemes woocommerce plugins use the default woocommerce templates folder described in this documentation:
2 cases:
You have already a
woocommerce
folder in your active child theme (or theme).
Copy fromplugins/woocommerce-mix-and-match-products/templates/single-product/mnm/
tothemes/your_active_theme/woocommerce/single-product/
Andplugins/woocommerce-mix-and-match-products/templates/single-product/add-to-cart/mnm.php
insidethemes/your_active_theme/woocommerce/single-product/add-to-cart/
You don't have any
woocommerce
folder in your active child theme (or theme).
Copy fromplugins/woocommerce-mix-and-match-products/templates/
inside your active child theme (or theme) and rename itwoocommerce
.
So in your case you will have:
themes/storevilla-child/woocommerce/
Reference: WooCommerce Template Structure + Overriding Templates via a Theme
来源:https://stackoverflow.com/questions/39568208/overriding-specific-third-party-woocommerce-plugin-templates