I have directly modified the class-wc-checkout.php
file from includes
folder in woocommerce plugin to add custom line item meta
data. Is there any way to override
the class-wc-checkout.php file from my-theme folder as we override template files in woocommerce?
To override WooCommerce template files in your theme (or better yet, child theme) simply make a folder named 'woocommerce' within your theme directory, and then create the folders/template file you wish to override within it.
To do that just copy the WooCommerce template you need to customize and add it to your plugin folder. Now all the customizations you need to make to the WooCommerce cart page can be made in the 'cart. php' file in your plugin folder.
If yes, then go to the Templates->Theme Builder then go to Single Product tab and make all of them Draft. Then after try to override the single-product. php . Thanks!
As mentioned in the comments, wc_get_template_part() tries to locate and load the requested template file. These template files could be ether in the /woocommerce/ sub-directory of a child-theme, or defined in another third party plugin (with the help of woocommerce_locate_template filter hook).
Example
You need to edit file: /plugins/woocommerce/includes/shortcodes/class-wc-shortcode-products.php
Copy the file to themes/YOURTHEME/inc/class-wc-shortcode-products.php
Add to function.php:
require 'inc/class-wc-shortcode-products.php';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With