Woocommerce Reorder single page hooks, description showing twice

I’m making a woocommerce theme and I’m having trouble reordering the single page hooks. I want the product short description to appear under the product title.

I’ve been able to move the short description under the title using the remove / add action, I added this to the function.php file

Read More
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 10 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 7 );

Here’s what my content-single-product file looks like

<div class="summary entry-summary">

    <?php
        /**
         * woocommerce_single_product_summary hook
         *
         * @hooked woocommerce_template_single_title - 5
         * @hooked woocommerce_template_single_excerpt - 7
         * @hooked woocommerce_template_single_rating - 20
         * @hooked woocommerce_template_single_price - 20
         * @hooked woocommerce_template_single_add_to_cart - 30
         * @hooked woocommerce_template_single_meta - 40
         * @hooked woocommerce_template_single_sharing - 50
         */
        do_action( 'woocommerce_single_product_summary' );
    ?>

The problem is now the description is showing up twice, once in the new position (under the title) and another time it’s original position (under the price)

Any help would be greatly appreciated! Thanks.

Related posts

Leave a Reply

2 comments

  1. Ok I’ve been able to change the hook position in the wp-template-hooks.php file directly.

    * Product Summary Box
    *
    * @see woocommerce_template_single_title()
    * @see woocommerce_template_single_price()
    * @see woocommerce_template_single_excerpt()
    * @see woocommerce_template_single_meta()
    * @see woocommerce_template_single_sharing()
    */
    add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
    add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_rating', 10 );
    add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
    add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 7 );
    add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );
    add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_sharing', 50 );
    

    My question now is why can’t I change these by Removing/Adding actions to the functions.php file?

  2. add this function to your theme functions.php

    add_action( 'init', 'remove_content' );
    function remove_content() {
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_rating', 10 );
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 7 ); 
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_sharing', 50 );}
    

    In case you like add some elements again, use add_action and change priorities if needed.