Woocommerce shop page custom template

78,749

Solution 1

I know it's too late and you may have figured it out by now. In any case, the changes that you would like to make to the WooCommerce Shop Page need to be done in the archive-product.php and it would be safer to create a child theme and do these changes. Making enhancements and customizations in a Child theme is best practice so that you can update the parent theme at any time and it won't affect your store.

I hope this helps, for more information on how you can use WooCommerce short-codes to customize your store can be found here.

Solution 2

To add to Silver Ringvee's answer - he used is_page but that only works on wordpress pages. For woocommerce you need to use something like is_woocommerce() . See Woocommerce conditional tags page.

My example code uses the is_shop conditional tag as that was the page you wanted to change. the code get_template_part( 'content', 'shop' ); will call the file content-shop.php in your theme root folder. This code is to be added at the top of wp-content\themes\*theme*\woocommerce\archive-product.php that you can copy from wp-content\plugins\woocommerce\templates\archive-product.php

You can add it just before get_header( 'shop' ); line 23 in my file - and the entire page will be drawn from your template. If you want to keep the header of the shop page, then put this code after the get_header code. Remember to include a footer in your file as well

if (is_shop()) {
 get_template_part( 'content', 'shop' );
} else  {  
#normal archive-product code here
}
Share:
78,749
Silver Ringvee
Author by

Silver Ringvee

Analytics & A/B Testing Expert in digital analytics and user behavior analysis. Running advanced A/B Experiments using Optimizely, VWO and Google Optimize. Translating data to insights with Google Analytics, Google Datastudio and more. Front End Making great ideas happen using modern web technologies. Always open to new opportunities! Daily use: Javascript, JQuery, HTML5, CSS3, Python, PHP5, MySQL, WordPress, Twitter, Bootstrap and a few more.

Updated on October 16, 2020

Comments

  • Silver Ringvee
    Silver Ringvee over 3 years

    As I understand by default Woocommerce shop page uses product archive template. What I am looking for, is to use a custom template for shop page.

    Here is what I did:

    1. Create template "my-shop"
    2. Create page "My shop" -> choose template "my-shop"
    3. Choose "My shop" as Woocommerce shop page

    But none of the changes I made to "my-shop" template are present on the shop page.

    What am I missing here? I would not like to change product archive itself, just the shop page.

    Is there a way to disable product archive from being a default for shop page?

    Thanks

  • Jon
    Jon about 6 years
    Woocommerce is open source. Everything is possible.
  • addedlovely
    addedlovely over 4 years
    Isn't that a bad idea from a performance perspective, adding 1 redirect to every homepage visit?
  • Lakin Mohapatra
    Lakin Mohapatra over 3 years
    Using child theme , we can customize it.