Show SKU Under Product Title In WooCommerce

Share Now

#Add this code in fucntions.php

// ******************* SHOW SKU ****************** //
add_action( 'woocommerce_single_product_summary', 'hoop_show_sku', 5 );
function hoop_show_sku(){
    global $product;

    if ( $product->is_type( 'variable' ) ) {
      $available_variations = $product->get_available_variations();
      for ($i = 0; $i <  count($available_variations); $i++ ) {    
          echo '<div class="var-sku"><p>SKU: ' . ($available_variations[$i]['sku']) . '</p></div>';
      }
    } else {
      echo 'SKU: ' . $product->get_sku();
    }
}
Picture of Nahid Mahamud

Nahid Mahamud

Web Developer | Graphic Designer | WordPress & Woo-commerce Expert