Show Product SKU Number in WP e-Commerce

This page is in the Code Graveyard where I lay to rest snippets of code that I don't use anymore. Some have lost their usefulness due to the evolving nature of the web, while others have been replaced with better code. "Be Ye Warned!"

This is for use with WP e-Commerce plugin. Use this code if you want to display the “SKU” item number on the single product page (in wpsc-single_product.php). The SKU number is not the same as the Product ID number. The Product ID number (which is like the post ID) is assigned automatically by WordPress. The difference between that and the SKU number is this: You get to assign your own SKU number for each item in your store. Assigning a SKU number is optional.

If you do use SKU numbers for your products, this code will show the SKU on the single product page:

<?php
echo wpsc_product_sku(wpsc_the_product_id());
?>

To display the SKU preceded by “Item #”, like this:

Item #: 203403

Then use the following code in wpsc-single_product.php. (The following also includes “itemprop=”identifier”, which is microdata that helps generate rich snippets in search engines. This item property only works within the “Product” type.)

		
<?php 
$isa_sku = wpsc_product_sku(wpsc_the_product_id());
?>
<span class="isa_sku">Item #: <span itemprop="identifier" content="sku:<?php echo $isa_sku; ?>"><?php echo $isa_sku; ?></span></span>

Show the SKU in the shopping cart widget

If you want to show the SKU in the shopping cart widget (in cart_widget.php), instead of the above code, use:

<?php
echo wpsc_product_sku(wpsc_cart_item_product_id());
?>

See more: ,

We've 6 Responses

  1. October 21st, 2012 at 7:21 am

    Hi,
    I want to show the SKU number on my single products page, item list and shopping cart.
    I added the code mentioned in your article in the respective php-files, but the SKU number is not shown on my site.

    What can I do?
    Thanks!
    Diego

    Diego
    • October 21st, 2012 at 5:32 pm

      Have you assigned a SKU number to each product? If yes, and it still doesn’t work, then it may be a WP E-commerce bug. I’ve stopped using this plugin altogether several months ago. Aside from all its bugs, the plugin creators (http://getshopped.org) claim to be working on a complete rewrite of the plugin, so I don’t see a point in working with their code until then. I’ve switched to WooCommerce, and it’s excellent.

      Isabel
      • October 22nd, 2012 at 6:21 am

        Hi,

        The SKU number is filled in the wp e-commerce product site.

        I now also activated the WooCommerce. And it looks great. I have 1 problem, the WooCommerce CSV import does not function on my side. I use regular CSV-files for this plugin, but when entering the ‘start’-button, I get a white screen.

        How can I easily import a lot of products in WooCommerce through the use of a free plugin?

        Thanks!

        Diego

        Diego
  2. December 5th, 2013 at 1:34 am

    Hi Isabel,

    Not sure if you can do the same thing in woocommerce as mentioned above – I want the SKU to appear on the cart page or better still in the order at the back end. All my products have SKUs.

    Hope you can help..

    Thanks anyway,
    ☮ Nick

    Nick

Questions and Comments are Welcome

Your email address will not be published. All comments will be moderated.

Please wrap code in "code" bracket tags like this:

[code]

YOUR CODE HERE 

[/code]