do it simply - Help and Advice

How to create recurring bookings with Woocommerce

If you are looking for a Recurring Plugin it’s here.

The plugin is available here for $39.  View the demos too.

Lot’s of people love what Woocommerce Bookings can do, and many buy into the pretty expensive plugin before they realise some of limitations. I was one of them.

I had to learn pretty quickly that 2 of the most important features that my client wanted weren’t available out of the box with Bookings. The first was allowing customers to select the date first before seeing what they are able to book. You can see my write up to that selecting the date first, here.  The other big one is…

how to create a recurring booking

Woocommerce Bookings allows you to manually create a booking and this is where you start to create a recurring one.  From their website here is the basic code to create a booking programmically.

Now for many, this may just be enough to get you on your way, but some of us need a little more.  Below I will map out what I have done for my client.

I have modified the plugin to create 5, 6, or 7 week recurring bookings, this depends on the time of year.  These make up a course, I’m assuming same as what you are trying to do.  There is quite a lot of variability in the dates and resources for my version so I haven’t automated a huge amount yet (I am planning on it for a plugin).

    I'll send you the plugin when it's ready

    Please note: we do not share your information with anyone else. We will only use it to share helpful information regarding our plugin development.

    My other main variable is that my system allows you to have different resource capacity on each of those recurring dates.  For instance Mar 18th might have 24 places and Mar 25th may have 32.  This was a specific client request, and makes what I’ve done a little more complicated.

    Here are the basics.

    1. Create a product that describes the course/classes (as I’ve done here).  No dates or anything are needed in the product itself, you will do this manually.  I suppose there is no reason you can’t supply a calendar here and use the selected date as the start of your bookings.  It wasn’t necessary for my version.

    2. Create a bespoke plugin to work along side Woo Bookings. – You can do this in function.php but it can become really messy really soon.

    3. Create a function to do the work that hooks into  the action ‘woocommerce_payment_complete’

    4. The function will loop through the items in your completed order, if the item matches the course (product) id, then you will manually create your recurring bookings.

    5.  Creating the manually bookings needs the following parameters, the product_id you are booking against, the start date, the number of weeks, and the resource_id (if used).

    So, here is my seemingly complicated function, but if you read through it, it’s not too difficult to figure out.

    Some things to note on my function.

    a. I am manually entering the product and resource ids because these are constantly changing for my client.  You could create (and I will eventually) an admin bit to allow you to set these in the CMS.
    b. Normally the resource id wouldn’t have to change per week you could use the same, again this is bespoke for my client.
    c. My client has variations too, sometimes this is course level, sometimes it’s course length, so I have to check for this in my function too.
    d. I have also added a check in this function to see if they have purchased a membership, if they have I add a coupon to their basket which gives them 20% off of their booking.

    As I’ve previously mentioned, more of this can be automated or looped… I’m working on it.. 🙂

    I’d like to hear what you’ve tried to do or got stuck on.  My ultimate goal is to write this into a plugin to help others.  To do this I would like more use cases.  So please send me a note.

    Update: First plugin version available.

    You can visit my Github repository for the first version of the recurring bookings plugin.  Please feedback how you get on.

      I'll send you the plugin when it's ready

      Please note: we do not share your information with anyone else. We will only use it to share helpful information regarding our plugin development.

      Good luck!


      Posted in Developers, For Business OwnersTagged , ,

      6 responses to “How to create recurring bookings with Woocommerce”

      1. beth says:

        Hi Guillermo. I have a version of it, but it’s not ready for general release. I’m hoping to work on it in April.

      2. beth says:

        Thanks Guillermo, I will send you an email. Beth

      3. Pradeep M. says:

        Hi Beth,

        Great article and the snippets! Sorry this is not directly related to the topic discussed in here but is there a way for us to create new ‘booking statuses’ for WC Bookings (not order statuses)?


        • beth says:

          I’m sorry Pradeep. I’m not sure what you are asking here. What type of statuses would you want for bookings? There are already pending, confirmed, etc. Depending on your set-up. I’m sure there is a hook to add your own specific ones.

      4. Nicholas McLean says:

        Hello! I was just brainstorming yesterday on how to use product add in’s to allow customers to automatically let bookings recur weekly!

        I’ll let you know how it goes!

      Leave a Reply

      Your email address will not be published. Required fields are marked *