Website Building » WooCommerce » How Do I Change the Product Page Template in WooCommerce?

How Do I Change the Product Page Template in WooCommerce?

Last updated on January 17, 2023 @ 4:30 pm

There are a few different ways that you can change the product page template in WooCommerce. One way is to simply edit the template file within the WooCommerce plugin folder.

Another way is to create a child theme and then override the WooCommerce template files.

If you want to edit the WooCommerce template files directly, you can do so by going to the wp-content/plugins/woocommerce/templates folder. Within this folder, you will find all of the template files used by WooCommerce.

Simply edit the file you want to change and then save your changes.

PRO TIP: When making changes to the product page template in WooCommerce, it is important to be aware that this can have an impact on other areas of the site. If you are not comfortable with making code changes, it is recommended that you seek out a professional developer to help make the changes for you.

If you would prefer to create a child theme and override the WooCommerce template files, you can do so by following these steps:

  1. Create a child theme folder and give it a name (e.g., my-child-theme).
  2. Within the child theme folder, create a file called functions.php.
  3. In functions.php, add the following code:
<?php

function my_child_theme_enqueue_styles() {
  $parent_style = 'parent-style';
  wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
  wp_enqueue_style( 'child-style',
  get_stylesheet_directory_uri() . '/style.css',
  array( $parent_style ),
  wp_get_theme()->get('Version')
);
}
add_action( 'wp_enqueue_scripts', 'my_child_theme_enqueue_styles' );

?>

This code will enqueue the stylesheet for your child theme.

Next, copy the template files you want to override from the WooCommerce plugin folder to your child theme folder, and make your desired changes. The template files in your child theme folder will take precedence over the ones in the WooCommerce plugin folder.

It is important to note that when a new version of WooCommerce is released, any customizations made to the template files may be overwritten. To avoid this, it is recommended to regularly backup your customized template files and reapply them after updating WooCommerce.

In summary, there are two ways to change the product page template in WooCommerce: by directly editing the template files within the WooCommerce plugin folder or by creating a child theme and overriding the template files. Both methods can have an impact on other areas of the site, so it is important to be aware of this and to make regular backups of your customizations.

Morgan Bash

Morgan Bash

Technology enthusiast and Co-Founder of Women Coders SF.