skip to Main Content

I’m trying to move the title of my products on top (on top of the image) but i’m not sure how to do it… I want the title to be uptop on the product page not the archive page.
I’ve spent a long time researching about how to do it but nothing seems to work…

Is there a hook to move it ? Maybe change the layout on the product_page.php ?

2

Answers


  1. Chosen as BEST ANSWER

    First solution didnt worked but it might be related to my theme.

    Second solution worked like a charm even tho i changed the hook :)

    To answer my question : How to move the title on top of the product :

    //First remove default title
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
    //Second add title
    add_action( 'woocommerce_before_single_product', 'woocommerce_template_single_title', 5 );
    

  2. For better understanding the product template see the default content-single-product.php – https://gist.github.com/dompascal/7825580 and use this visual map – https://www.businessbloomer.com/woocommerce-visual-hook-guide-single-product-page/

    In your functions.php file in your active theme add the following:
    Solution #1

    //First remove default title
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
    //Second add your title in thumbnail section - Keep in mind that title will be below the image bcs of the way this hook works
    add_action( 'woocommerce_product_thumbnails', 'woocommerce_template_single_title', 5 );
    

    Solution #2
    Another way is to place title above all (depends on your design)

    //First remove default title
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
    //Second add title
    add_action( 'woocommerce_before_single_product_summary', 'woocommerce_template_single_title', 5 );
    

    Solution #3
    Override woocommerce templates in your theme. There is alot of examples but this is a good starting point – https://woocommerce.com/document/template-structure/
    This solution will provide the best output of your template BUT will require more maintance in future.

    If you use theme that override those templates or hooks then you need to work with the theme hooks. But this is specific per theme.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search