3

I am trying to set up a shop for my site using WooCommerce. My goal is removing the "Product Categories" (and maybe "Search" box) on product archive/shop base page. I know editing the "product-archive.php" file is required. But I just can't find it! It should be somewhere in woocommerce/templates/ directory, but there's no such directory! I'm using Fruitful theme by Fruitfulcode. I'm using the latest versions of WordPress and WooCommerce. I tried virtually anything: installing and reinstalling WooCommerce, installing an older version of WooCommerce... Nothing works. There's no woocommerce/templates directory anywhere in my theme!

Could you please assist me? Am I doing something wrong?

Mazhar
  • 54
  • 5

5 Answers5

17

I think you're a bit confused about how WooCommerce template overrides work. Here's some important info you should be aware of:

  1. Installing WooCommerce won't modify your theme at all.
  2. You shouldn't have a woocommerce/templates/ directory in your theme, even if the theme is overriding default WooCommerce templates. Rather, you may have a woocommerce/ directory (without the templates/ directory).
  3. WooCommerce templates are overridden by copying template files from /wp-content/plugins/woocommerce/templates/xxx.php to wp-content/themes/yourtheme/woocommerce/xxx.php

If you aren't seeing a woocommerce directory in your theme, that means that your theme is using the default WooCommerce templates. If you would like to override them, you need to copy the product-archive.php template from the WooCommerce plugin templates directory into a woocommerce/ directory within your theme.

More info in the WooCommerce documentation.

Nathan Dawson
  • 18,138
  • 3
  • 52
  • 58
rnevius
  • 26,578
  • 10
  • 58
  • 86
1

By default, there won't be any woocommerce fil s inside your theme folder. If you want to customize the Woocommerce tempalte files, you need to copy the files which you want to edit from TEMPLATES folder inside the Woocommerce plugin folder and paste inside your theme folder under folder name called WOOCOMMERCE.

Rajeev
  • 1,376
  • 2
  • 15
  • 33
0

Reading your answer twice I think you may be speaking of widgets since you mention categories and search box. This is usually in the sidebar. You don't need to edit woocommerce template files to change this.

Look for the widget that is being displayed on the archive pages and remove the ones you don't need.

Go to Appearance/widgets and look for the sidebar that is being displayed on the shop and delete the unwanted elements.

You could also use the customizer to view it visually while doing it.

Hope this helps

Mozahler
  • 4,958
  • 6
  • 36
  • 56
Ryon Whyte
  • 31
  • 1
  • 5
0

Im sorry if this doesn't help answer your question but the file you're looking for is archive-product.php not product-archive.php, this is the second question I've seen with this non-existent file mentioned.

blackhill24
  • 422
  • 14
  • 30
0

If a child theme is being used, the absolute path to the parent theme directory will be returned. Use get_stylesheet_directory() to get the absolute path to the child theme directory.

You need to use get_stylesheet_directory_uri() instead of get_template_directory() in your child theme.

echo get_template_directory()

/*Retrieve theme directory URI.*/
get_template_directory_uri()

require get_theme_file_path( 'inc/post-types.php' );
kiner_shah
  • 3,939
  • 7
  • 23
  • 37