WooCommerce Template Override

Feb 15, 2024 | Blog

How to Override WooCommerce Templates in Your WordPress Child Theme

Overriding WooCommerce templates in your WordPress child theme allows you to customize the appearance and functionality of your store without making direct changes to the WooCommerce plugin. This approach is recommended to ensure your customizations remain intact and your site remains update-safe. 

We recommend not doing this because you can usually make changes with hooks (filters and actions). It’s a safer approach for small tweaks and ensures better compatibility with WooCommerce updates. But you might have to change the template if there’s no hook for what you need. Here’s how to achieve this:

Understand WooCommerce Template Structure

The default WooCommerce templates are in the WooCommerce plugin directory under wp-content/plugins/woocommerce/templates/. These templates control various parts of your WooCommerce store, like product, cart, and checkout pages.

Create a WooCommerce Folder in Your Child Theme

To override a template, create a woocommerce folder in your Child Theme’s directory. The path will be wp-content/themes/your-child-theme/woocommerce/.

Copy the Template File to Your Theme

Find the template file in the woocommerce plugin folder you want to override. Copy it into the same place inside the woocommerce folder of your child theme. Make sure the folders inside your child theme’s woocommerce folder look just like they do in the WooCommerce plugin. For example, to override the single product page, copy ‘single-product.php’ from ‘wp-content/plugins/woocommerce/templates/’ to ‘wp-content/themes/your-child-theme/woocommerce/’.

Edit the Copied Template File

Open the template file you copied into your child theme’s woocommerce folder. Change it per your requirements, such as editing the HTML or adding/editing PHP code. Make sure not to remove any WooCommerce hooks in the file unless you plan to change those.

Review Your Changes

After saving your changes, visit your website to see the effects of your modifications. Make sure that your changes do not break any functionality and that the appearance is as expected.

Keep Your Overrides Up to Date

Whenever WooCommerce releases a new version, check if any of the templates you’ve overridden have been updated. If so, you may need to apply these updates to your customized templates to ensure compatibility and functionality with the latest version.

Best Practices

  • Backup your site Take the backup before making changes to templates.
  • Document your changes so you or someone else can understand what was done and why, which is helpful for future maintenance.
  • Test your site thoroughly after making changes, including checking for mobile responsiveness and cross-browser compatibility.

Following the steps above, you could effectively customize your WooCommerce store to match your requirements.

Posted By:
Arif
Development Head at Elicus and has over 13 years of experience in the WordPress development industry.

1 Comment

  1. Fotowoltaika

    Thanks for that. I need this solution to place templates in my child theme.

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

1 Comment

  1. Fotowoltaika

    Thanks for that. I need this solution to place templates in my child theme.

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Easy Methods to Create a Post Slider for WordPress Using Elementor

Easy Methods to Create a Post Slider for WordPress Using Elementor

If you're looking to create a post slider for WordPress on your website, then in this post, you can find the easy steps on how to do that. I'll share the step-by-step process that would allow you to create your WordPress post slider in the least time. There are two...

7 Best Elementor Books and Courses (2025)

7 Best Elementor Books and Courses (2025)

Elementor is a big name when it comes to building a WordPress website. However, if you’re a beginner to WordPress, then the same tool can give you a hard time. How? Because it’s not the same WordPress page builder it was used to be 5 years ago.  When I started my...

Explore, Learn, Grow: Join Now!