Move Woocommerce Single Products Title

I was trying to move the product title at Woocommerce single product page to different location. The accepted location is just under itemscope itemtype="http://schema.org/Product" and i was trying to remove first the title from current location which is remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_title', 50); but not removed the title from current location.

Another problem is I can’t add product title to new location which I have used do_action( 'woocommerce_moved_product_title_position' ); and then add_action('woocommerce_moved_product_title_position', 'woocommerce_template_single_title', 60);

Read More

I am using Woocommerce 2.4.13 and WordPress 4.4.1

Please help me to solve this. It’ll be great for me.

Related posts

2 comments

  1. Weirdly, you must call remove_action from inside a function.

    function so_34845641_move_title(){
        remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_title', 50); 
        add_action('woocommerce_moved_product_title_position', 'woocommerce_template_single_title', 60);
    }
    add_action( 'woocommerce_before_single_product', 'so_34845641_move_title' );
    

    Just a suggestion that there are probably enough hooks without needing to add a custom do_action() in the templates.

  2. Run the remove_action inside a function doesn’t change anything , but change the priority work for me.

    I give you an example:

    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20);
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30);
    add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 15 );
    add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 10 );
    

    Pay attention and try with differents priorities.

Comments are closed.