WooCommerce, Remote Work & Other Fancy Stuff

Just another WordPress site

Remove Cost From WooCommerce Bookings Resource Dropdown

May 13, 2015 by Will 3 Comments

Please consider leaving a donation if you appreciate this information. Lightning network now available

If you’re using customer selected resources with your WooCommerce Bookings products and those resources have costs then an indication of a price adjustment for those resources is output in the dropdown select.

Bookings Resource with cost adjustment

Bookings Resource with cost adjustment

You can remove those if you would like. There are a couple of ways to do that.

The first approach would be to remove that with a filter. Bookings provides a filter for the form fields called booking_form_fields which can be used to remove that. It is a bit tricky because the text that needs to be removed will be variable. My approach to this is to use a regular expression to match a pattern and replace that pattern with an empty string. Here’s a code snippet that will do this:

The other approach would be to use a template override. Bookings provides a way to override templates in a very similar fashion to the way that WooCommerce does it. You can read more about that here: Template Structure + overriding templates via a theme. The Main difference is that there is a different template override path for Bookings, i.e. wp-content/themes/YOUR-THEME/woocommerce-bookings the default template files can be found in wp-content/plugins/woocommerce-bookings/templates/. It is considered best practice to only override the templates necessary. For this case, the default template is called select.php and can be found in wp-content/plugins/woocommerce-bookings/templates/booking-form/ – again, I will use a regular expression to match and then replace a string of text – effectively removing the price indicator. You can see the edits needed by comparing the default template file to this:

 

If you would like to download, Register or Login

Not sure what to do with code snippets? See What Do I Do With These Code Snippets?

Please consider leaving a donation if you appreciate this information. Lightning network now available

Filed Under: Bookings, Template Overrides, WooCommerce Tagged With: bookings, regex, snippets

Comments

  1. Graham says

    August 15, 2016 at 1:19 am

    This seems to have broken since Woo 2.6+ as the span class=”amount” seems to be missing now?
    Are you able to see if this code can be tweaked for the new format?
    Many thanks.

    Log in to Reply
    • will says

      August 28, 2016 at 1:37 pm

      Change the pattern to something like this:
      ‘#\(\+\$.*\)#’;

      Log in to Reply
    • vuewer says

      February 8, 2017 at 4:50 pm

      This snippets works for me:

      Add https://gist.github.com/WillBrubaker/b05bdf91da70a8a44b8f969bfcac694a to functions.php

      Log in to Reply

Leave a Reply Cancel reply

You must be registered and logged in to post a comment.

© 2025 ยท WooCommerce, Remote Work & Other Fancy Stuff · Epstein didn't kill himself

We use cookies to ensure that we give you the best experience on our website. Continued use of this site is interpreted as your acceptance of our cookie policy.OkSee Our Cookie Policy