AdvertisingBest of

BlogCommerce HOW TO: Adding Ecommerce To Your Blog

So you want to sell products directly from your blog? We have already decided it could be a great idea for creating revenue, let’s take a look at how exactly we add ecommerce capability to your blog.

The process of adding ecommerce to your blog is technically no different to taking sales orders on any website, the main difference is one of organisation. You need to work out the user experience well so the blog and sales process are nicely integrated and not a big stinking mess.

For a start it needs to be easy to browse and link to the products. Visitors are only going to become customers if they can find and purchase something. Permanent links are important for search engine optimisation.

For us to be able to say we have an ecommerce enabled blog we need to be able to do three things.

  1. Present the products
  2. Take orders for products
  3. Receive Payment

Catalogue

You have three choices for presenting product information.

The first choice is simply to use blog posts or static pages to show the product off. This is the simplest route and works well if you make sure the products are well linked so do not simply drop off the homepage into the archives.

Next choice is to look to see if there is a plugin for your blog software. Looking around I found an ecommerce plugin for WordPress and an ecommerce module for Drupal.

Third option might be out of reach for many and that is to integrate a full ecommerce system into your blog. I would say this is only necessary if your needs are very advanced. Having said that it should be possible to integrate an open source product such as OSCommerce and the system is well known by developers.

Shopping Cart

You might find it is not necessary to have a shopping cart. If you are selling an ebook or something where a customer will only order one item then checkout a simple buy button would be sufficient.

For those cases where someone might want to build up a shopping cart full of merchandise you will need to either use a plugin as mentioned above or use the built-in shopping cart of your payment provider as in our Paypal example below.

Payment Systems

The whole point of this exercise is to get paid isn’t it? Before jumping right into the deep end with a merchant account and credit card payment system we can start small with some of the more immediate and easier to use options.

paypal

Most people have heard of Paypal if not used it, especially ebay users, although it is not available for all countries, and fees vary from country to country. There are no setup or cancellation fees.

A couple of example rates are listed below.
UK – Standard Rate (£0.00 GBP-£1,500.00 GBP) 3.4% + £0.20 GBP per transaction
US – Standard Rate ($0.00 USD-$3,000.00 USD) 2.9% + $0.30 USD per transaction

2checkout

Another popular choice for people selling small, infrequent items. The main advantage is they cater for many more countries (there is a small list of banned countries mind, North Korea, Cuba, etc). There is a $49 signup fee then 5.5% + $0.45 per transaction.

clickbank

A favourite among ebook merchants, Clickbank specialises in digital products and has a built in affiliate solution. Many affiliates specialise in moving Clickbank products from their sites so it is worth looking at.
There is a $49.95 setup fee then 7.5% + $1 markup (varies depending on affiliate commission payout you choose).

You might find you can get better fee structures through your bank or with a true third party payment provider once you are up and running and have sales figures to show. Until then these solutions should suffice to get you working.

WordPress Shopping Cart

While initially I was delighted to discover this plugin I was dismayed it worked fine until checkout … when it wouldn’t. I know others have managed to get it working though so please do try it and let me know how you get on.

Setting up is quite simple, you download the zip, upload to your plugins directory. Once uploaded you simply enable the plugin and set up some static pages as instructed, inserting tags in each that will be replaced with the values of the shopping cart etc. After you have set up your product range that is all you need to do in theory.

The free version integrates with Paypal, you have choice of payment providers with the paid option but I wouldn’t trust my money on the product just yet till I was sure I could get the free version going! A bit of a minus is the products do not have friendly-formatted permalinks, which is a big shame.

Drupal Ecommerce Module

I had a lot more success with the Drupal solution. It is a little more complicated than the WordPress plugin as there are several modules rather than just the one but it all seemed to work and products each get a URL (by default the standard Drupal “node” type of address). Individual users can have their own stores too, great for a multiblog!

There is a database to setup plus you will need to do quite a lot of work in the aesthetics department but it all works nice and smooth. After setting up your database changes you just need to upload and enable the required modules and create your products.

What is nice about the Drupal solution is it handles not just the shopping but also provides some back office functionality for dealing with orders and shipping, etc.

Paypal Merchant Options

Paypal gives you the option of using a simple “buy now” button or a functional shopping cart. You can also have recurring payments which are great for forums and content subscriptions. They have a PDF download that explains everything but mostly there are forms and wizards to create the necessary code unless you want to do complicated things with scripting.

While you can “encrypt” the information you set in the Paypal button forms to prevent tampering, I am of the opinion that where Paypal is concerned you are best off sending the item after the correct money is visibly in your account. Call me paranoid but until you are getting hundreds of orders I think this is the safest bet and I have heard too many cases of people downloading ebooks without paying a penny.

Adding a “buy” button is as simple as

Here is how it looks in my WordPress based blog

This is great but we can do better!

I created a parent page called “Products” and two child pages, one for each of my products. While researching this topic I thought of using posts rather than pages but I like to keep the products linked from the right navigation and my posts use dated URLs whereas I would like to keep the product URLs clean. You might like to use posts as I expect the code might be a little bit simpler and my installation doesn’t seem to search pages …

WordPress has the feature for custom variables when you create pages. I cobbled together my own solution using this functionality. I created a value for price and thumbnail. In price I put in the value for the item and in thumbnail I provided a URL to a small graphic.

For my product list I took the standard “page” template and created a new one for “products”. My product list and my products use this template. I put some logic in to work out if it was the product list or product, you might find it easier to have two templates instead. Here is my code for showing an individual product details with a customised “buy now” button. (This appears right after “the_content” in the standard template).

if ( get_post_meta($post->ID, ‘price’, TRUE) != ” ) {
$price = get_post_meta($post->ID, ‘price’, TRUE);
}
echo “Price: $” . $price;
?>

As you can see, now the button gets created based on the product name and ID information and product price so there is no copying and pasting required.

The code for a paypal shopping cart (“basket” for us in the UK, heh) is very similar but you also need a second button for viewing the basket. When a user clicks either of these a new browser window is opened for the Paypal information.


You will notice you can supply a URL for successful transactions plus an address for if the customer cancels. These allow you to show thankyou or help messages, and also the success page is where you would put your Google Analytics or custom ROI tracking code if you have it.

To show the list of products I used the following PHP code which pulls out the values in a similar way.

global $wpdb;

echo ”

    “;
    $pages = $wpdb->get_results (“SELECT * FROM $wpdb->posts WHERE `post_parent` =” . $wp_query->post->ID);
    foreach ($pages as $page) {
    $price = get_post_meta($page->ID, ‘price’, TRUE);
    $thumb = get_post_meta($page->ID, ‘thumbnail’, TRUE);
    echo ‘

  • ‘ . $page->post_title . ‘ $’ . $price . ‘‘;
    }
    echo “

“;
$pages = “”;

// end show list
?>

It queries the post data and returns a list of pages where the parent is the current page, extracting thumbnail, price and URL to display links.

I can’t see any reason why this solution could not be implemented in most dynamic blog systems with some small changes in implementation.

Summary

If we want to do this completely there are two more things we need that are not essential but great to have. The first of these is “back office” administration. Yes you can use a spreadsheet etc but it’s nice to have everything right there. Unfortunately only the Drupal solution has anything near approaching this right now so we would have to do some more coding.

Second is we really need to have some great tracking in place. We need to know where your sales are coming from so we can optimize. If we have good tracking and we are making sales then there is nothing to stop you advertising to create even more sales. That is when your blog/store will really take off. At present only Google Analytics has support for conversion tracking that I could find. Ah well. Let’s walk before we run, eh?

So what is the verdict? Well I found it much easier to roll my own solution than the available plugins. I think I will try 2Checkout in addition to Paypal too. I definately think there is something in this merging of blogs and ecommerce but it seems right now nobody in the ecommerce system market is catering for this specific need very well. I am going to keep working on my own solution, I just need to decide what I am going to sell!

How about you, are you going to give it a try?

Author: Chris Garrett

Chris Garrett is a content marketing and blogging coach and co-author of the Problogger Book with Darren Rowse.

3 thoughts on “BlogCommerce HOW TO: Adding Ecommerce To Your Blog

  1. Hi Chris, I ran across this article of yours from a Seth Godin post and wondered what you thought about my incorporating my newsletters for sale on my blog instead of on a separate website. I am in the midst of reworking my newsletters to break them down by industry and so will have several lots to choose from for about $400.00/lot…and then the option of getting them all for a year plus someother full online service. And, wondered if you did this type of work and what you would charge to do it? I am wondering if one does this, if they need to keep two websites then?

    thanks,
    kim

Comments are closed.