How to edit plugin files safely?

I want to edit the add to cart section on the product single template of the woocommerce plugin.

I would like to know whether it is a good practice to put the code directly in the file.

If not, what are my alternatives and how do I add the code correctly in order for wordpress to know where I want the code to take effect?

3 Comments
  1. It’s WooCommerce; you should to make you change via one of its action or filter hooks via your theme’s `function.php` file or a custom plugin. Or copy the WC template file you are interested in, along with its parent directories, in to your theme.

  2. Never edit the core WC files directly, make a copy of the file and save it to your theme and edit the PHP file there. This ensures that your custom edits remain in tact when WC pushes a core update.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer