• Resolved xroc

    (@xroc)


    How can i display SKU on single product pages? I have 0 knowledge of coding so i cannot make any snippets to make this happen. I tried this snippet but it didnt work:

    add_action( ‘woocommerce_single_product_summary’, ‘dev_designs_show_sku’, 5 );
    function dev_designs_show_sku(){
    global $product;
    echo ‘SKU: ‘ . $product->get_sku();
    }

Viewing 6 replies - 1 through 6 (of 6 total)
  • Looks like a good snippet for that job.

    In what way didn’t it work? Did it crash your site or just nothing happened?

    Some themes have different hooks. What theme are you using?

    Plugin Support B C. a11n

    (@battouly)

    Hi @xroc,

    By default, WooCommerce will display the SKU on the product page unless there is something in the theme that changes this.

    To test this you can use a default theme like the Storefront theme.

    If you find your theme is indeed the problem, and you want to still use it, you can go with the customization.

    Here is a useful plugin to add codes: https://www.ads-software.com/plugins/code-snippets/

    Thread Starter xroc

    (@xroc)

    Hey,

    Nothing happend and we are using Flatsome Theme

    Flatsome theme is a commercial theme, so www.ads-software.com forum members don’t have access to its code.

    Do you have a theme template file at:
    wp-content/themes/flatsome/woocommerce/content-single-product.php
    if so you can look in there for the hooks which flatsome uses.

    Thread Starter xroc

    (@xroc)

    I got it! thank you very much

    Plugin Support B C. a11n

    (@battouly)

    Hi @xroc ,

    Looks like you are all set and ready to move on.

    I’m going to mark this as resolved. If you have any further questions, you can start a new thread.

    Best!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to display SKU on single product page’ is closed to new replies.