Override woocomerce files from folder

I directly modified the class-wc-checkout.php file from includes in the woocommerce plugin to add user data for line item meta . Is there a way to override the class-wc-checkout.php file from the my-theme folder, since we are redefining the template files in woocommerce?

early

+6
source share
5 answers

I had the same problem. I do not need reviews on my site, so I copied what I wanted to remove from the file inside the includes folder and copied it to my functions.php file as follows:

 // Remove reviews from WooCommerce if (! function_exists( 'woocommerce_default_product_tabs')) { function woocommerce_default_product_tabs($tabs = array()) { } } 

It works for me!

+6
source

What seems to work for me is to put the file here:

 /wp-content/themes/YOURTHEME/includes/class-wc-checkout.php 

The difference between the other offer and mine is that I do not have a woocommerce folder on the way.

+3
source

I'm not too sure what you are editing for the Woocommerce plugin, but yes, you can override the woocommerce plugin by adding these hooks and filters to your functions.php file in the subject:

http://docs.woothemes.com/document/hooks/

+1
source

Folder files of only templates can be overridden by moving them to your child theme.

For all other files, such as in folder files, you can edit them or use hooks and filters to do this.

+1
source

Yes, you have to do this by uploading to this folder

/wp-content/themes/YOURTHEME/woocommerce/includes/class-wc-checkout.php

0
source

Source: https://habr.com/ru/post/971766/


All Articles