• Resolved jeremynative

    (@jeremynative)


    Has anyone ever been able to figure how to add a label to a woocommerce product name?

    IE instead of;

    Baseball

    I would want it to be for every product:

    Title: Baseball

    Here’s my shop product page with the missing “Title:” for an example https://www.jeremynative.com/shop/ayeuonganit-wampum-ayim%EA%9D%8Fup-wampum-made/

    The one catch is that I would like to add a <span> around the “Title:” because that would allow it to blend with the formatting of the other attributes underneath.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • vankaa

    (@vankaa)

    Try using the template\single-product\title.php template.

    It looks like you got this done. If you have modified templates, you should make a child theme:
    https://codex.www.ads-software.com/Child_Themes
    and put the modified templates at
    wp-content/themes/child-theme-name/woocommerce/ (no templates folder) ….php
    so they won’t get overwritten by updates.

    Thread Starter jeremynative

    (@jeremynative)

    I wanted to try to avoid messing with the php files in case the updates change them, but I received a working solution here, thank you for both of your help!

    How to add label to Woocommerce title?
    byu/jeremynative99 inWordPress

    remove_action(‘woocommerce_single_product_summary’,’woocommerce_template_single_title’,5);
    add_action(‘woocommerce_single_product_summary’, ‘woocommerce_my_single_title’,5);

    if ( ! function_exists( ‘woocommerce_my_single_title’ ) ) {
    function woocommerce_my_single_title() {
    ?>
    <span>Title: </span><h1 itemprop=”name” class=”product_title entry-title”><?php the_title(); ?></h1>
    <?php
    }
    }

    I’m using a theme that isn’t compatible with Woocommerce, so the title was affecting many of the menu and other items. This solution worked

    Thanks @jeremynative for looping back, and sharing the solution.

    I’ll go ahead marking this as resolved. If you have any further questions, you can start a new thread.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How do you add “Title/Name:” to product name on product page?’ is closed to new replies.