With the Booking and Appointment Plugin for WooCommerce, you can add resources to multiple services and set their costs from the admin end of the booking settings. However, sometimes you may want to show only the resource without the price on the front end to keep the user interface less cluttered or to avoid showing price options to customers.
In such cases, you can use the below code snippet and hide the resource price in the dropdown to simplify the selection process.
Solution: Hide Resource Price from Resource Dropdown in WooCommerce Booking and Appointment plugin
The below code snippet will hide the prices associated with resources displayed in the resource dropdown on the product page.
/** * Do not show Price in the Resource Dropdown. * * @param string $price_str Price String. * @param array $resource_data Resource Data. * @param int $product_id Product ID. * * @return string */ function bkap_resource_price_in_dropdown_callback( $price_str, $resource_data, $product_id ){ return ''; } add_filter( 'bkap_resource_price_in_dropdown', 'bkap_resource_price_in_dropdown_callback', 10, 3 );
Output
When a customer visits the booking page and selects the resources dropdown, they will only see the resource names without the prices.
This is how the resources along with their associated prices as configured in the backend were displayed before the code was implemented.
Similarly, you can also customize the ‘Select Resource’ text on the shop page with an approprite resource to better match the service you provide using a Booking and Appointment plugin. This makes it easier for customers to understand their choices, reduces confusion, and helps them book more successfully.