We are releasing a beta version of Viva Shortcodes a smart little add on for the WP-Ecommerce plugin that allows you to call individual store items and a sample collection from a store category from within your posts using handy short codes . It really extends the way you integrate your shopping cart with your wordpress site.

From our own experience WP-Ecommerce is rather buggy, to say the least, but it is freely available and, for the most part unencoded (RANT!). The biggest issue we have is that while it handles product management very well within the Pages of the store there is very limited options to add any dynamic content from the shop into other wordpress pages. So,  if I am writing about a product in a post and want to add the Product image, or info or an ADD TO CART button  inside that post, I can’t. And that bugged me! So I fixed it!

So here’s my own little add-on plugin. It isn’t full feature but it does allow you to add content inside a post or page of wordpress with links to an Add to Cart or Buy Now button. So inside a post you can add this:


Add a category snippet with add to art buttons in grid or list view

or a single item detail like this:

Or a single item with description or just Buy Buy Now Button

Or a single item with description or just Buy Buy Now Button

Before we make this an official release plugin we would welcome your feedback if you are using WP-Ecommerce and would like to try it out. Please add your comments below.


You can download the plugin here: HERE (2.3 kB) - 886 downloads to date.

Upload the file to your plugins folder and Activate.


Usage: Add the shortcode into your post or page


[category cat=3 list=4 type=grid]

Variable cat is the category ID you want displayed

Variable list is the number of items from that category to show (good for a teaser row and you can then add a link to the full category page in your WP-Ecommerce store)

Variable type is optional - defaults to full which presents each item with image, title, description, price and Add to Cart button . Options are grid (prints items horizontally across the page) or list (items are printed vertically)


[product id=4 type=full]

Variable id is the product ID number (what a surprise!!)

Variable type is optional - defaults to full which presents each item with image, title, description, price and Add to Cart button .

Variable type can be set to full, cart or buy. The latter two options simply print an Add to Cart or Buy Now button to the page (useful if you are discussing a product in an article and just want to create the link as it would appear in the shop


Unlike the code of WP-Ecommerce where even experienced coders get quite lost, you can edit the plugin file to alter the HTML that is displayed in the page for each shortcode command. ( This is editing the plugin not through a Dashboard page) and for anyone with basic php/html experience this should be possible though is not necessary as the styling for the layout should be pulled from your ship stylesheet.


You can always contact us for custom support on WP-Commerce plugin as we have become really familiar with it over the last few months due to client requests that have included multiple tax levels, automatic shipping options, customizing shop storefront and many more! If you need any help please contact us for a quote.

24 Responses to “WP-Ecommerce Shortcodes Plugin”
  1. Just great! I’ve been looking for something like this to get rolling. Thanks!

  2. Thanks! I was looking for a way to add product shortcodes to WP e-Commerce!

    Have a couple of comments.

    Big request:
    The individual product shortcode needs “Variations” support. Some of our products require variations to be seen. Any plans to add this?

    Validation bugs:
    - Need to remove the STYLE tag from the body; give users to the option to turn off inline styles and add documentation for styles that need to be added to the CSS
    - The [span] tag for the product price isn’t closed properly

  3. Also I couldn’t get the [product id=x type=buy] shortcode to work.

    Is there a reason for using this?
    $output =”[buy_now_button=".$id."]“;

    Instead of the actual input code?

  4. Ray - we will look at adding Variations support in a future release. As I said in the post, this isn’t full feature yet, just a beta release to gauge interest and feedback as I have noticed quite a few requests for it on the E-commerce Support forums.

    Style tags will be taken out of inline in an official release and so you can edit it all through a stylesheet.

    The only reason to add the BUY option using the same [product id=x type=buy] format was to have a consolidated shortcode command to remember. I will take a look to see why you might be having problems with the code. It works fine on our test sites.

    Thanks for the feedback - keep it coming.

  5. Thanks for replying Tim.
    I’m glad such a plugin currently exists.

    Hopefully we will see a new release with Variations support soon.

    Just thought of another feature request:
    - Removing shortcode content from the RSS feed.

  6. Nice one, thanks a ton, it’s great to be able to move the products around in the site in a more flexible manner and this plugins definitely takes that one huge step forward.

  7. its great. i used it for my shop. thank u

  8. Yeah thanks for this guys. It is a great step forward and we’re also keen to look at integrating this functionality into the core - it definitely makes sense to do this with our next full 3.7 release that comes with a template engine.

    The next minor update version 3.6.10 will come with a couple of additional goodies…

    Add to Cart Shortcode: [add_to_cart=1]
    Add to Cart PHP:

    And if you’re lucky…

    Add to Cart Shortcode: [add_to_cart=1,fancynotifications]

  9. A request/question:

    I would love to be able to just list the variations, no actual shopping cart interaction necessary. I’m using the EC plugin to manage workshop registration. Each type of workshop is a Variation and the different dates that workshop is available is handled as a set of Variation Values. It works well, since a student can choose their workshop and then select the date from the drop down box.

    What I would like is to be able to call a list of the just the Variations and their multiple Variation Values. That list would, in essence, be an upcoming event list. Even more helpful would be to sort that list by the variation values so the list showed up in chronological order. Do you see that as a possibility, either as part of your plugin or as custom work for my requirements?



  10. I’ve been looking for something like this for so long, you are absolutely amazing.

    Also is there a way to make a link that goes to the individual item? I’m looking around your coding and don’t see that actually put into it… I’m sure I’ll figure out a way to do it but just wondering.

    Once again, thanks for your amazingness, you have solved a big headache for me. Looking at this also shows the capability to apply really any ‘theme’ you want to a product gallery which ecommerce theme doesn’t allow (well unless you change a bunch of stuff).

    You are the best


  11. Also is there a way to reverse the order they are shown in? Like most recent (right now it shows it by oldest to newest)

  12. @Peter - Listing your Products and variations would be possible but ordering them by date between Products would not be possible as the Variation is not actually being stored as a date but a text field so the field would only be orderable alphabetically or numerically.

    @Brandon - To create a link to the actual Individual item you should just use the URL for that item page. Surely that is quicker than looking up the Item ID and then adding a shortcode into the post.

    Order of posts should be controlled by the settings inside your Ecommerce dashboard options. If that is not making any difference check the top of the plugin file. On line 40 -

    $wpdb->prefix.”product_order`.`order` ASC LIMIT $list”);

    Try editing the ASC to DESC.


    PS - The good news is that the WP-Ecommerce team have taken notice of this post and said they are going to integrate our ‘hack’ into their next release so you should find the functionality soon part of the CORE!! Yay!!

  13. Thanks for the response, Tim. I have found where the fields are stored in the database. If I get someone to write this piece of code for me, hopefully they can parse the date text field and sort it chronologically, as long as I’m consistent on how I enter the variations.

    BTW, I couldn’t get your listing ‘hack’ to work, despite going in and changing some double quotes that were throwing up Wordpress errors. I know another reader had the same problem but solved it. I haven’t been so lucky. Congrats on having your code included in a future release.

  14. Hi, Im a newbie,
    I use Shortcode but my “Add to Cart button” is not show

  15. Hi, wonderfull code. Compared with instinct’s shortcodes it really works. Just a small problem: My landingpage is a difficult theme based on pages,posts and hard coded entries. The unparsed [shortcode] won’t work. Is there ANY PHP equivalent say to display single products AND/OR all products from a secific category? I am searching the net since one week and can’t solve the problem…..THANKS!

  16. nice plugin i hope the wp e-commerce team take the documentation and make it readily available when they integrate the functionality and they do not take away the grid functionality

  17. @Geeche - Have you tried the Advanced Include Page Plugin. This way you can create a page with the Shortcode and then have that page INCLUDED in the homepage code - the shortcode will be run first so should work. I have used this with some success on a number of sites

  18. I’d love to be informed when I can add variations into my short codes! Any idea how long before you guys plan on a full feature release? Kind of waiting on it at this point…


  19. Wonderful plugin. I think a feature which all of us would like would be to have the thumbnail image (when using the [category cat=3 list=4 type=grid] code) link directly to the item listing in the shop. Not many people would click a buy now button without reading a bit more about an item first!

  20. Hello there, just tried to install your plugin on WP 2.7.1 on a WAMPserver got the following error:

    Warning: include_once(C:\wamp\www\wordpress/wp-content/plugins/viva-short-codes.php/) [function.include-once]: failed to open stream: Invalid argument in C:\wamp\www\wordpress\wp-settings.php on line 473

    Warning: include_once() [function.include]: Failed opening ‘C:\wamp\www\wordpress/wp-content/plugins/viva-short-codes.php/’ for inclusion (include_path=’.;C:\php5\pear’) in C:\wamp\www\wordpress\wp-settings.php on line 473

  21. Figured out what it was, I tried to use the activation from zip file. It didn’t work out. Works when folder is created and plugin activated.

  22. that’s simply great..

  23. I want to get the category view to look like the one in your screenshot, but I can’t. How can I show the category name with a “view all” link?

  24. The Category name and VIEW ALL link are just hardcoded into the page content! :)

Leave a Reply