[Support request] WooCommerce Archive Pages – Show SKU

Home Forums Support [Support request] WooCommerce Archive Pages – Show SKU

Home Forums Support WooCommerce Archive Pages – Show SKU

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #619037
    Steve

    Hi Tom

    I need to show the SKU below the Product Title but above the price on the individual products on the Archive, Search Results and Shop Page.
    I am using Code Sippets and have managed to find the following code which puts the SKU in the individual product lines in the Cart.

    add_filter( ‘woocommerce_cart_item_name’, ‘add_sku_in_cart’, 20, 3);

    function add_sku_in_cart( $title, $values, $cart_item_key ) {
    $sku = $values[‘data’]->get_sku();
    return $sku ? $title . sprintf(” (SKU: %s)”, $sku) : $title;
    }

    On the current Site for this Client which is using the Old WooCommerce Canvas with a Child Theme I have used:
    Part No. <?php echo ‘

    ‘ . $product->sku . ‘

    ‘;
    In the “content-product.php” Template to produce the result.

    Results can be found at stedall.co.uk – select a product category from “Products” on the menu.

    This is messy as I need to update the Template as Woo move the version on with major upgrades.

    I would like to incorporate the above code line from content-product.php in a Code Snippet which would avoid the problem.

    Can you help. Even better for the future it would be great if this function could be incorporated directly into GP in the wooCommerce module, with the ability to add your own title.

    Best Regards

    Steve

    GeneratePress 2.1.3
    GP Premium 1.6.2
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.