Typically with eCommerce payment is collected, well, electronically. Sometimes though, you need to collect cash in hand, which is why WooCommerce comes with the Cash on Delivery gateway.

Typically if this gateway is used with WooCommerce Bookings, the bookings created will sit in an Unpaid status until they are manually updated by the store admin. Where this works for some, it does not work for all. So here comes the star of this post, the snippet:

This snippet takes code straight from Bookings itself and processes orders a second time only if they have COD as their payment method. It will put the associated bookings into a Confirmed status automatically. It also includes a filter to check to make sure the booking hasn’t already been set to Paid or Completed to make sure those statuses stay intact.

4 thoughts on “WooCommerce Bookings and COD payments

  1. This looks perfect for my use case.

    Please forgive my ignorance, I am a developer, but I don’t know WordPress. Where do I slot this in to get it working? Do I need to create a plugin out of it?

    Any guidance is appreciated!

  2. It would need to be added in the functions.php file of your theme or child theme. There are also plugins that allow you to add snippets like this, I believe one is named Functionality.

Leave a Reply

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

5 + four =