Viewing 4 replies - 1 through 4 (of 4 total)
  • sku isn’t a property of the product object, but try:

    $product->get_sku();

    For some themes, title.php could be overwritten by theme updates. The recommended way is to make a child theme and use a hook in functions.php.

    Thread Starter OliverSDPMEDIA

    (@oliversdpmedia)

    I currently use a child theme, could you tell me the full code for the title.php file?

    Also, could you elaborate on using a hook in functions.php? (a code possibly I can copy in)

    This is for functions.php in your child theme:

    add_action('woocommerce_single_product_summary', 'show_sku', 7);
    function show_sku() {
      global $product;
      echo '<div class="sku">SKU: ' . $product->get_sku() . '</div>';
    }

    The top line of functions.php is:

    <?php

    You may have that already.

    Hooks and filters are here:
    https://docs.woothemes.com/wc-apidocs/hook-docs.html

    A hook allows you to insert other content, and a filter allows you to edit the default content.

    Thanks for then snippet Iorro ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘SKU underneath Single Product Title’ is closed to new replies.