Writing a Wordpress plugin

Posted Sep 22nd, 2007 by Rich

A while ago I was asked if I could write a shopping cart. I had already started one a few years ago, but never finished it. So I began to go through the scripts and tidy them up ready for use. But part way through I discovered that what was really needed was something to integrate into Wordpress.

During the process I realised that turning it into a plugin would provide many advantages. A major one of which was the ability to process the orders within Wordpress admin. The scripts grew, bugs were found, integration with paypal was eventually managed and finally we achieved our goal.

The result was that Mike Cherim was finally able to open up his online shop for Green Methods: Biological Pest Control and Integrated Pest Management.

Most of the coding I have done is seriously behind the scenes. Mike was responsible for creating products, and styling everything. I had to take his products, using his existing framework and integrate a set of shopping cart scripts. Mike’s ideas pushed things far beyond what I had imagined, and we both hope that users of the shop enjoy their experience.

But how did we get to that point. There were two or three shopping cart plugins out there, but they had flaws that made them unacceptable for our needs. Over use of javascript, complicated, and integrated, product entry and poor mark-up. I looked at adapting those scripts, but decided it would actually be quicker to adapt my own. Problem was I knew nothing about writing a wordpress plugin!

I learnt as I went along, and I dare say there are a few places where things could be achieved a lot easier, but it works! and that is the main thing.

Of course leaving it there would be one option. However I decided part way through, or Mike suggested it, that releasing it as a plugin could be an option for the future. This may actually become a reality.

But Wordpress is limited when it comes to using it as a Content Management System, let alone a shop! So I have been scouring the Wordpress site, utilising Google searches and am getting closer to having all the necessary snippets to begin writing a full blown paypal shopping cart for Wordpress. Mike has already offered, or was that press ganged?, to help with layout, CSS, enhancement suggestions and testing.

But as a always when writing scripts, we can’t think of everything. Wish lists and suggestions will be appreciated.

Updated 1st October

Currently the feature set may include some or all of the following, plus any I think of as the work progresses.

  • 1 product per page - done
  • Product form will appear on the edit page - done.
  • Products can have options - done.
  • Shipping rates - done.
  • Parent page will be able to list sub pages just like categories with posts (hopefully) - done.
  • Admin Order handling section - done.
  • Automatic emails on successful purchase, with option to send one from the admin order handling- done.
  • User configurable email - done.
  • Configurable Out of Stock message - done
  • Automatic form/message for each product added to page - done.
  • Automatic creation of required pages - done
  • Pages added to Wordpress search - done

Then along came a new set of features, which need integrating before launch:

  • Upload downloadable products - nearly completed
  • Full handling with stats for downloadable products - nearly completed
  • Integrate with product entry menu - to do
  • Integrate with shopping cart front end - to do
  • Integrate with shopping cart back end - to do
  • Other integration to ensure I don’t miss anything - to do

8 Responses to: “Writing a Wordpress plugin”

  1. John Faulds responds:
    Posted: September 23rd, 2007 at 11:21 pm

    Would it be possible to give a list of features that will be included? And then people could suggest ones that are missing that they think would be important.

  2. John Faulds responds:
    Posted: September 24th, 2007 at 10:39 pm

    1 product per page

    I’d think the ability to display more than one product, ie, all products in a particular category, would be high on most people’s wishlists.

  3. John Faulds responds:
    Posted: September 25th, 2007 at 10:36 am

    I guess it’s hard to describe as a feature but aside from it being easy for customers to use, the main thing I’d think people would be looking for would be ease and flexibility of adding and updating products including product images.

  4. luukmuu responds:
    Posted: December 15th, 2007 at 7:59 am

    Thank for plug-in.


Post a Comment

Enter Your Details:


You may write the following basic XHTML Strict in your comments:
<a href="" title=""></a> · <acronym title=""></acronym> · <abbr title=""></abbr>
<blockquote cite=""></blockquote> · <code></code> · <strong></strong> · <em></em>

  • If you’re a first-time commenter, your response will be moderated.
  • If your response includes a link, it will require moderator approval.
Enter Your Comments:

Comments will be sent to the moderation queue.