Overriding specific third party Woocommerce plugin templates

落花浮王杯 提交于 2019-12-31 03:18:06

问题


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:

  1. You have already a woocommerce folder in your active child theme (or theme).
    Copy from plugins/woocommerce-mix-and-match-products/templates/single-product/mnm/
    to themes/your_active_theme/woocommerce/single-product/
    And plugins/woocommerce-mix-and-match-products/templates/single-product/add-to-cart/mnm.php
    inside themes/your_active_theme/woocommerce/single-product/add-to-cart/

  2. You don't have any woocommerce folder in your active child theme (or theme).
    Copy from plugins/woocommerce-mix-and-match-products/templates/
    inside your active child theme (or theme) and rename it woocommerce.

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!