Move category description to the bottom
-
Hi there!
there is any way to put the category description below the products?
Here is my page and as you see there is a lot of text. I need to move those texts of all categories below the products.
Thank you
Alex
-
The structure will be:
1-TITLE OF CATEGORY
2-PRODUCTS
3-CATEGORY DESCRIPTIONThe technique is to unhook the actions that put the descriptions at the top, and add new actions to put them back at the bottom:
<?php remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 ); remove_action( 'woocommerce_archive_description', 'woocommerce_product_archive_description', 10 ); add_action( 'woocommerce_after_main_content', 'woocommerce_taxonomy_archive_description', 40 ); add_action( 'woocommerce_after_main_content', 'woocommerce_product_archive_description', 40 );
Code goes in functions.php for your child theme or you can use the “My Custom Functions” plugin.
The above is for the default WooCommerce template. If your theme has its own archive-product.php, the hooks might be different.
Sorry, not tested. I don’t have access to your theme.
Hi, this kind of does the trick but as you say you’re code is for the default theme.
I’m using the 2012 child theme and it put the description over to the left of the screen.
I cannot see an Archive-product.php in my theme folder so I wondered if you had any other thoughts on this.
Any help would be greatly appreciated.
thanks
Sean
Please post the url to a relevant page showing the description over to the left.
Hi, sorry late reply, heres the URL :-
https://www.devineride.co.uk/product-category/sale-snowboard-boots/
Since I last posted, I also noticed that in Archive-Product.PHP, it contains the following bits of code among many others. If I comment out the “do action” bit of code then it hides the description but i would prefer it to be visible below the products so google can index on it.Thanks.
<?php
/**
* woocommerce_archive_description hook.
*
* @hooked woocommerce_taxonomy_archive_description – 10
* @hooked woocommerce_product_archive_description – 10
**/
do_action( ‘woocommerce_archive_description’ );
?>Hi Goochy, I saw that you were able to accomplish the description below the products. What did you end up doing to get it to work? which files did you modify and how? I need to do it myself. thanks!
The approach is to remove the actions that cause the description to be output at the top of the page:
remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 ); remove_action( 'woocommerce_archive_description', 'woocommerce_product_archive_description', 10 );
Then add the actions back in using a different hook that fires lower down the page:
add_action( 'woocommerce_after_main_content', 'woocommerce_taxonomy_archive_description', 40 ); add_action( 'woocommerce_after_main_content', 'woocommerce_product_archive_description', 40 );
Themes can vary so look at archive-product.php for which hooks fire where.
Best not to alter theme or plugin files as any edits will be over-written by updates. These lines go in functions.php for your child theme. If you don’t have a child theme, you can use the “My Custom Functions” plugin.
Some PHP skill will be needed.
Hi, I have the same problem, I tried all your coding but it did not work. Could you please help? this is one of my category page: https://thefunnygift.com/product-category/dog-costumes/
many thanks
valentino
@valextino
Looks like you have the premium version of the Vogue theme. Commercial themes are not available to www.remarpro.com form members so I’ve no idea what code they are using. You’ll need to look for the hooks your theme has used. Start with archive-product.php. If not, if you can get an unzipped copy of your theme onto your hard drive you should be able to text search it there.using child theme functions.php I can duplicate the description to the bottom, but can’t seem to get rid of the top of the page description. Here is the archive-product.php used in the theme woocommerce folder:
<?php /** * The Template for displaying product archives, including the main shop page which is a post type archive. * * Override this template by copying it to yourtheme/woocommerce/archive-product.php * * @author WooThemes * @package WooCommerce/Templates * @version 2.0.0 */ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly // get the style global $woocommerce_loop, $blog_id; $cookie_shop_view = 'yit_' . get_template() . ( is_multisite() ? '_' . $blog_id : '' ) . '_shop_view'; if ( yit_get_option( 'shop-view-type' ) != 'masonry' ) { $woocommerce_loop['view'] = isset( $_COOKIE[ $cookie_shop_view ] ) ? $_COOKIE[ $cookie_shop_view ] : yit_get_option( 'shop-view-type', 'grid' ); } get_header( 'shop' ); ?> <?php /** * woocommerce_before_main_content hook * * @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content) * @hooked woocommerce_breadcrumb - 20 */ do_action( 'woocommerce_before_main_content' ); ?> <?php do_action( 'woocommerce_archive_description' ); ?> <?php if ( have_posts() ) : ?> <?php /** * woocommerce_before_shop_loop hook * * @hooked woocommerce_result_count - 20 * @hooked woocommerce_catalog_ordering - 30 */ do_action( 'woocommerce_before_shop_loop' ); ?> <?php woocommerce_product_loop_start(); ?> <?php woocommerce_product_subcategories(); ?> <?php while ( have_posts() ) : the_post(); ?> <?php wc_get_template_part( 'content', 'product' ); ?> <?php endwhile; // end of the loop. ?> <?php woocommerce_product_loop_end(); ?> <div class="clearfix"></div> <?php /** * woocommerce_after_shop_loop hook * * @hooked woocommerce_pagination - 10 */ do_action( 'woocommerce_after_shop_loop' ); ?> <?php elseif ( ! woocommerce_product_subcategories( array( 'before' => woocommerce_product_loop_start( false ), 'after' => woocommerce_product_loop_end( false ) ) ) ) : ?> <?php wc_get_template( 'loop/no-products-found.php' ); ?> <?php endif; ?> <?php /** * woocommerce_after_main_content hook * * @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content) */ do_action( 'woocommerce_after_main_content' ); ?> <script type='text/javascript'> /* <![CDATA[ */ var yit_shop_view_cookie = '<?php echo $cookie_shop_view; ?>'; /* ]]> */ </script> <?php /** * woocommerce_sidebar hook * * @hooked woocommerce_get_sidebar - 10 */ do_action( 'woocommerce_sidebar' ); ?> <?php get_footer( 'shop' ); ?>
- This reply was modified 7 years, 3 months ago by raginghamster.
Did you try the standard removes:
remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 ); remove_action( 'woocommerce_archive_description', 'woocommerce_product_archive_description', 10 );
If that doesn’t work, do a text search in your theme files for ‘woocommerce_archive_description’
you may find something like:
add_action(' 'woocommerce_archive_description', 'vogue_custom_product_archive_description', 10 );
in this example, the remove action would be:
remove_action(' 'woocommerce_archive_description', 'vogue_custom_product_archive_description', 10 );
None of those have any effect. I found this in my themes woocommerce.php
add_filter( 'yit_get_option_layout', 'yit_sidebar_shop_page', 10, 3 ); remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 ); add_action( 'yith_before_shop_page_meta', 'woocommerce_taxonomy_archive_description', 10 );
i attempted to use this
remove_action( 'yith_before_shop_page_meta', 'woocommerce_taxonomy_archive_description', 10 );
`again no effect
Thank you so much @lorro. It worked perfectly well for me.
Does anyone know how to do this with storefront theme?. I am half way there. The “add action” works fine. The “remove action” doesn’t work, so I end up with the description both above and below the products.
Any help appreciated.@printvent
The upper description could be hard coded in themes/storefront/archive.php at line 20. As a test, comment out that line. If this works, consider making a child theme with this modified file.
- The topic ‘Move category description to the bottom’ is closed to new replies.