Site logo

Archived topic

Sku view in woocommerce product view

3 replies · Started by Alberto on April 16, 2020

Viewing posts 1–4 of 4

Hello, I would need that in addition to the image and the title you can see below the sku of each product.

It's possible?

I attach the url of the product view page.

Thank you in advance

Hi there,

you can use this PHP Snippet:

function db_woo_display_sku_shop() {
      global $product;
        if ( $product->get_sku() ) {
       echo '<span class=”shop-sku”>SKU:' . $product->get_sku() . '</span>';
    }
 }
add_action( 'woocommerce_after_shop_loop_item', 'db_woo_display_sku_shop', 9 );

Adding PHP: https://docs.generatepress.com/article/adding-php/

Thanks David!

It works perfectly!

You're welcome

This archived topic is closed to new replies.