Woocommerce Template Plugin

Voocommerce Template Plugin

About WooCommerce Template Hints I broke my back to adapt WooCommerce to one of SiteOrigin's designs and builders. I use Orbisius Kid Thme Creator, which is great. When you want to make your own custom kid themes, have a topic you've spent a great deal of your attention on, or need to change your design, this is the help to you!

Overwriting of the WooCommerce template file within a plugin

Aim of this paper is to describe an attempt to overwrite WooCommerce kernel template data within a user-defined plugin so that it can still be overwritten by a topic in the usual way. Notice that this is similar, but resolves a slightly different issue than what we have done to build a customized, rewritable Woocommerce template in your customized plugin.

Overwriting a kernel template in your plugin is something you might want to do if you're building a WooCommerce plugin that needs to change a kernel template and you don't want to have to provide a template to fall into the topic, yet you also want the freedom to overwrite the template in the topic.

Fortunately, WooCommerce's template load system provides a great deal of flexibility in controlling where template data is uploaded from, and allows us to do just that. WooCommerce's standard template charger scans the following places in order until a matching is found: We' ll change this slightly by including a template lookup in our own customized plugin (step 3 below) before eventually retreating to the WooCommerce kernel template directory:

You can do this by including the following feature and the following filtering, which essentially replicates and modified the behaviour of the woocommerce_locate_template() feature found in woocommerce cores.

To overwrite loop/add-to-cart.php for example, copy this into your plugin at the following location: myplugin/woocommerce/loop/add-to-cart.php and make your changes.

It can still be overwritten by the design, and all other template data is uploaded as usual from WooCommerce or the standard directory.

Mehr zum Thema