WooCommerce Bookings has a form which allows your customers to choose the duration of their booking, the number of persons to book, the date and resources.
All the fields are shown in a specific order by default, which is

  1. Duration (if not fixed)
  2. Number of persons
  3. Resources (if not automatically assigned)
  4. Calendar

Do you need to change this order? Great, here is a snippet for you then.

Open the file functions.php located in wp-content/themes/your-theme-name/ and add this code at the end of the file:

From the line 2 to 5 it copies the default values of each field. Then from line 7 it begins to reorder the fields and returns the array of fields using the new order.
In this example, the first field will be the calendar, the second the resource, then the duration and at last the persons field.

You can obviously change this order by moving the lines from 8 to 11 up and down as you need.

Note: This is only a basic example. If you use persons type or multiple resources the code may change.

9 replies
  1. ben
    ben says:

    Hi Nicola!!

    Thanks of an amazing blog, tried this but it spat a whole load of errors out at us, has anything changed which would prevent this working that you know?

    Reply
  2. Ray Flores
    Ray Flores says:

    Hey Nicola – great blog… I have recently been following along, and came upon this post about bookings… I’m currently attempting to show the booking calendar on the cart page (to make any last minute changes)… do you have any insight on how to do this?

    Reply
    • Nicola Mustone
      Nicola Mustone says:

      Hi Ray,
      that would be quite hard to do. Definitely not supported in the core. I’d suggest to hire an expert to make this change since it’s not something that can be explained easly on a blog, sorry 🙁

      Reply
  3. Roselle Ignacio
    Roselle Ignacio says:

    Hi thanks for this post.

    Do you know how to change the order of the Calendar days from Monday – Sunday to Sunday to Monday?

    Thanks in advance,
    Roselle

    Reply
  4. Samuel
    Samuel says:

    Hey Nicola!! Nice blog and thanks for you post. I have one question about bookings. Is it possible by default to have 2 persons and keep the option of select 1 person? Because if you select minimun 1 person and maximum 3, by default appears 1. I will like to have 2 by default.

    Thanks in advance!!

    Reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

You have to agree to the comment policy.

This site uses Akismet to reduce spam. Learn how your comment data is processed.