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

How to Set Fixed Booking Cost to 1 Hour Duration in WooCommerce Booking and Appointment Plugin?

Sometimes for booking services, you might need to change the pricing of bookings for promotional reasons or change prices for seasonal booking products. In this post, we will see how to control the pricing logic when using the Booking and Appointment plugin for WooCommerce.

Imagine an online banquet hall booking service that allows customers to book any number of hours at their convenience but for a fixed rate. In such a scenario, regardless of how many hours the customer selects, the code will always apply a fixed 1-hour rate as the booking cost.

Solution: Set Fixed Booking Cost to 1 Hour Duration in WooCommerce Booking and Appointment Plugin

The below code snippet will customize the pricing logic in the WooCommerce Booking and Appointment Plugin to always calculate the booking price based on a duration of 1-hour rate only, without considering the actual duration booked by the customer.

/** 
 * Always calculate the price for according to 1 duration
 * 
 * @param int $duration Selected Duration by customer
 * 
 * @return array
 */
function bkap_fixed_duration_price_callback( $duration ) {
	
	$duration = 1; // Price will be always calculated according to 1 duration even if the customer has chosen any duration.

	return $duration;
}
add_filter( 'bkap_fixed_duration_price', 'bkap_fixed_duration_price_callback', 10, 1 );

Output

When a customer books a banquet hall during an unseasonal time, the booking price is fixed to a 1-hour rate, no matter how many hours the customer selects.

How to Set Fixed Booking Cost to 1 Hour Duration in WooCommerce Booking and Appointment Plugin? - Tyche Softwares

Alternatively, you can also display a customized pricing model based on the duration selected by the customer. This way you can offer different pricing strategies for different products that align with customer preferences.

Browse more in: Code Snippets, WooCommerce Booking & Appointment, WooCommerce How Tos

Share It:

Subscribe
Notify of
0 Comments
Newest
Oldest
Inline Feedbacks
View all comments
Launch Alert: Flexi BOGO for WooCommerce! Create irresistible holiday discount sales with ease.Learn more
0
Would love your thoughts, please comment.x
()
x