Using Woocommerce, I would like to add the SKU instead of the product title in the following pages: Shop page, Cart page and Checkout page.
For example in shop page, I am able to add the SKU above the product title using the code below. However, the problem is that the SKU added doesn't have the link to the single product page.
add_action( 'woocommerce_shop_loop_item_title', 'sku_before_title', 9 );
function sku_before_title() {
global $product;
$sku = $product->get_sku();
echo '<p class="name product-title">Product ' . $sku . '</p>';
}
What is the correct code to have SKU instead of product title and keeping the same link and CSS as the product title? Code for Shop page and Cart page and Checkout page.