Black Friday & Cyber Monday SUPER SALE ALL WEEK:
Grab 40% OFF on plugins
Days
Hours
Minutes
Seconds

How to Change the Duration Multiplier Text on the Frontend When Using the Booking and Appointment Plugin for WooCommerce?

When selecting the Duration Based booking type in the Booking and Appointment Plugin for WooCommerce, it shows a ‘Duration Multiplier’ that helps to indicate the number of hours booked. However, some customers find this confusing. By removing the ‘Duration Multiplier’ and just showing the hours label makes it clearer and easier to understand.

Solution: Change Duration Multiplier text on front end when using the Booking and Appointment Plugin for WooCommerce

The code snippet will remove the multiplier text displayed for duration-based type on the bookig product page.

/** 
 * Changes the displayed text format for duration based on time.
 *
 * @param string $into_hr_min Original String.
 * @param string $duration Duration Value.
 * @param string $duration_type Duration Type.
 * @param int    $product_id Product ID.
 * @param array  $bkap_setting Booking Settings.
 */
function bkap_hour_min_text_for_duration_field( $into_hr_min, $duration, $duration_type, $product_id, $bkap_setting ){
	$into_hr_min = sprintf( __( '%1$s %2$s', 'woocommerce-booking' ), $duration, $duration_type );
	return $into_hr_min;
}
add_filter( 'bkap_hour_min_text_for_duration_field', 'bkap_hour_min_text_for_duration_field', 10, 5 );

Output

To clarify the booking duration format the code will change the “8 x 1Hour(s)” format to simply 8 Hour(s) format when using the Booking and Appointment Plugin for WooCommerce.

How to Change the Duration Multiplier Text on the Frontend When Using the Booking and Appointment Plugin for WooCommerce? - Tyche Softwares

By default, the duration-based text format in the Booking and Appointment Plugin for WooCommerce is displayed as ‘ x 1Hour(s) ‘ as shown in the below image.

How to Change the Duration Multiplier Text on the Frontend When Using the Booking and Appointment Plugin for WooCommerce? - Tyche Softwares

Showing appropriate text in the right place improves clarity and enhances the user experience to make better decisions. For hotel booking services when using our plugin we have provided similar customization such as to change the text of the ‘Number of Days’ and ‘Price Per Day ‘ text displayed on the product booking page. If you are looking for any specific requirements, feel free to ask in the comments.

Browse more in: Code Snippets, WooCommerce Booking & Appointment

Share It:

Subscribe
Notify of
0 Comments
Newest
Oldest
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x