How To Override Woocommerce Include Files

Today, I would like to discuss a subject that is frequently encountered by developers working with WooCommerce: overriding WooCommerce include files. As a developer who has considerable experience with WooCommerce, I have encountered this task numerous times. In this article, I will lead you through the step-by-step process of overriding WooCommerce include files, offering personal insights and commentary along the way.

Understanding the Need to Override WooCommerce Include Files

Before we dive into the details, let’s briefly discuss why it may be necessary to override WooCommerce include files. WooCommerce is a powerful e-commerce plugin for WordPress, offering a wide range of functionalities out of the box. However, there are situations where you may want to modify or extend these functionalities to fit your specific requirements.

While WooCommerce provides hooks and filters to customize its behavior, there are times when modifying include files becomes necessary. Include files, such as templates and functions, are responsible for displaying various elements of your WooCommerce store, including product pages, cart, and checkout. By overriding these files, you can make changes to the way these elements are displayed and functioning.

Step 1: Create a Child Theme

The first step in overriding WooCommerce include files is to create a child theme. A child theme is a separate theme that inherits the styles and functionality of its parent theme, allowing you to make modifications without affecting the original theme files.

To create a child theme, navigate to your WordPress installation directory and locate the /wp-content/themes/ folder. Create a new folder for your child theme and give it a unique name, such as “my-woocommerce-child-theme.” Inside the child theme folder, create a new file called style.css and add the following code:

Theme Name: My WooCommerce Child Theme
Template: woocommerce

Save the style.css file, and your child theme is ready to be activated. Head over to your WordPress admin area, navigate to “Appearance” > “Themes,” and activate your newly created child theme.

Step 2: Locate the Include File to Override

Once you have your child theme set up, the next step is to locate the include file that you want to override. WooCommerce includes files are typically stored in the /woocommerce directory within the parent theme. For example, if you want to override the product page template, you would look for a file called single-product.php in the parent theme’s /woocommerce directory.

Copy the file you want to override from the parent theme’s /woocommerce directory to the same path within your child theme. This ensures that WordPress will load the file from the child theme instead of the parent theme.

Step 3: Make Modifications in the Child Theme

Now comes the fun part: making modifications to the include file in your child theme. Open the copied file in a code editor and make the necessary changes to fulfill your requirements. You can add, remove, or modify any code within the file to achieve the desired result.

For example, if you want to customize the product page template, you can change the layout, add additional information, or modify the styling to match your branding. By directly editing the copied file in the child theme, you can have full control over the display and functionality of your WooCommerce elements.

Step 4: Test Your Changes

After making the modifications in the child theme, it’s important to thoroughly test your changes to ensure everything is working as expected. Open your WooCommerce store in a web browser and navigate to the page or feature you have modified. Verify that your changes are visible and functioning correctly. Make any additional adjustments if needed.


Overriding WooCommerce include files can be a powerful technique for customizing the behavior and appearance of your online store. By following the steps outlined in this article, you can confidently make modifications in a safe and controlled manner without affecting the original WooCommerce files.

Remember to always create a child theme to ensure your modifications remain intact during theme updates. Additionally, thoroughly test your changes to ensure a seamless user experience for your customers. With practice and experimentation, you can harness the full potential of WooCommerce and create a unique e-commerce experience tailored to your specific needs.