• Hi, I am using the Lovetravel theme and I used this code to get the WooCommerce category description to the bottom:

    remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 );
    
       add_action( 'woocommerce_after_main_content', 'woocommerce_taxonomy_archive_description', 100 );
    
       add_action( 'woocommerce_after_shop_loop', 'woocommerce_taxonomy_archive_description', 100 );

    However, it is now shown above content and below the content. I only want to remain it below the content.

    How can I fix it?

    Please see: https://www.rondreis-griekenland.com/bestemmingen/corfu/

    Thanks in advance.

Viewing 8 replies - 1 through 8 (of 8 total)
  • You need to have only one of those add_action() calls. Try removing the first one.

    Thread Starter Jeroen-marketing

    (@jeroen-marketing)

    Hi Lorro,

    Thanks for your quicky reply.

    I changed it to:

    remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 );
    
       add_action( 'woocommerce_after_shop_loop', 'woocommerce_taxonomy_archive_description', 100 );

    I am, however, still on the same situation. I looked up the code with Google Chrome and I see this function twice:

    <div class="term-description">

    Maybe I have to see how I can disable that first section or so?

    Hope you can help!

    If you look at archive-product.php (your theme’s version if there is one, otherwise the WooCommerce plugin version) it will tell you what is hooked at the top.

    There are two actions in my archive-product.php. You’ve already unhooked one of them. The one you haven’t unhooked is:

    remove_action( 'woocommerce_archive_description' 'woocommerce_product_archive_description, 10 );
    

    The remove_action() priority parameter (the “10”) must be the same as the corresponding add_action() one. It should tell you the value used in archive-product.php.

    • This reply was modified 7 years, 9 months ago by Majeed Raza.
    Thread Starter Jeroen-marketing

    (@jeroen-marketing)

    Hi, thanks again your reply.

    I downloaded the latest WooCommerce version, because I don’t have access to FTP at the moment and archive-product.php is not included at the editor. The latest WooCommerce version just shows the 10.

    I tried the following codes:

    remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 );
    
    remove_action( 'woocommerce_archive_description' 'woocommerce_product_archive_description, 10 );
    
       add_action( 'woocommerce_after_shop_loop', 'woocommerce_taxonomy_archive_description', 100 );

    It said:
    Sorry, but your code causes a “Fatal error”, so it is not applied!
    Please, check the code and try again.

    Then I tried:

    remove_action( 'woocommerce_archive_description' 'woocommerce_product_archive_description, 10 );
    
       add_action( 'woocommerce_after_shop_loop', 'woocommerce_taxonomy_archive_description', 100 );

    That also gives a fatal error. So I got it back to how it was… but it’s still double. Maybe that pieci of code just does not work out for my website :'(

    You need a comma to separate the parameters. php is fussy! You can check php syntax using this service:
    https://phpcodechecker.com/

    Thread Starter Jeroen-marketing

    (@jeroen-marketing)

    Hmm, I think this is just a bit above my level. I’ll just remove everything and keep it the way it was… But thanks for all efforts, Lorro!

    You just made a typo:
    remove_action( 'woocommerce_archive_description' 'woocommerce_product_archive_description, 10 );

    You have missed the comma after the ‘woocommerce_archive_description’.

    So it should be like this:
    remove_action( 'woocommerce_archive_description', 'woocommerce_product_archive_description, 10 );

    That’s why you got that error.

    @trajektorijus

    Still a typo in there that will cause a fatal error

    There is an apostrophe missing after “woocommerce_product_archive_description”

    so this:
    remove_action( 'woocommerce_archive_description', 'woocommerce_product_archive_description, 10 );

    should be this:

    remove_action( 'woocommerce_archive_description', 'woocommerce_product_archive_description', 10 );

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Remove category description from top’ is closed to new replies.