[Resolved] Sku view in woocommerce product view

Home Forums Support [Resolved] Sku view in woocommerce product view

Home Forums Support Sku view in woocommerce product view

  • This topic has 3 replies, 2 voices, and was last updated 4 years ago by David.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1241701
    Alberto

    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

    #1241731
    David
    Staff
    Customer Support

    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/

    #1241754
    Alberto

    Thanks David!

    It works perfectly!

    #1241952
    David
    Staff
    Customer Support

    You’re welcome

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.