Display Best Selling Products in WP e-Commerce

Last few months I’m posted other tutorial for WP e-Commerce displaying featured products, I thought that’s the last thing they forgot to add in their Plugin built-in widgets but no, there are a lot more, I also noticed displaying best-selling products is one of the great feature and can’t be ignore, so today I’ll give you this simple snippet for displaying best-selling products in WP e-Commerce in an easy way.

How this snippet works?

  • Get lists of purchased products ordered by max number of product purchased
  • Use WP_Query to query those product ids, yes it’s possible since WordPress Ecommerce uses custom post-type for adding products
  • Use WPSC code to display product title, featured image, price or even add to add button

That’s it, happy coding ^_^

by Ryan Sutana

  • David

    I’m not sure when you posted this entry, but wanted to say thanks for posting it. I was able to use this as a starting point for a project I was working on, but needed to make a few changes. The first, was instead of counting how often each product appears, I needed to summarize the total quantity of the product purchased as opposed to the number of orders that contained the product. The second change, was I can only count completed transactions, so I had to join the query to the wpsc_purchase_logs table and filter on the processed fields so as not to count pending orders into the totals. Thought I’d post though couple of items in case anyone else is needing a slightly different result. Thanks again!