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

How to Show Fixed Block Price on Shop Page when using the Booking And Appointment plugin For WooCommerce?

In the Booking and Appointment Plugin for WooCommerce, we have a feature called ‘Fixed Block Price’ which will allow you to offer services for a fixed number of days at specific rates. For instance, if you are renting out cars you can set different costs for renting the car on weekends: say renting out for $200 if the car is booked on Saturday and Sunday.

To make this feature a more user-friendly experience to our customers we are going to offer a customization that will show the fixed block price directly on the shop page.

Solution: Show Fixed Block Price on Shop Page when using the Booking And Appointment plugin For WooCommerce

The code snippet will display clear pricing on the shop page if the fixed block pricing setup is configured with pricing details when using the Booking and Appointment plugin for WooCommerce.

/**
 * Show Fixed Block Price on Shop Page.
 */
function bkap_shop_display_fixed_price() {
	
	global $product;
	
	if ( function_exists( 'is_booking_active' ) ) {
		$product_id  = $product->get_id();
		$is_bookable = bkap_common::bkap_get_bookable_status( $product_id );
		if ( $is_bookable ) {

			$booking_settings = bkap_setting( $product_id );
		
			if ( isset( $booking_settings['booking_fixed_block_enable'] )
				&& $booking_settings['booking_fixed_block_enable'] == 'booking_fixed_block_enable'
				&& $booking_settings['bkap_fixed_blocks_data']
				&& ! empty( $booking_settings['bkap_fixed_blocks_data'] )
			) {

				$price = bkap_get_fixed_block_price( $product_id, $product->get_price() );
				echo '<div class="product-meta">Rental on Weekend: ' . $price . '</div>';
			}
		}
	}
}
add_action( 'woocommerce_after_shop_loop_item', 'bkap_shop_display_fixed_price', 9 );

Output

If the store owner has enabled the fixed block pricing feature, and configured specific rates for different days using the Booking and Appointment plugin, these prices will be prominently displayed on the shop page alongside the respective products.

For example, if the store owner has set a rental price of $200 for booking a car on a Saturday, customers will see this exact pricing listed next to the car’s details on the shop page.

How to Show Fixed Block Price on Shop Page when using the Booking And Appointment plugin For WooCommerce? - Tyche Softwares

Let me show you a glimpse of how the fixed block pricing feature is set up in the backend.

How to Show Fixed Block Price on Shop Page when using the Booking And Appointment plugin For WooCommerce? - Tyche Softwares

You can also find similar customizations related to the fixed block booking feature of the Booking and Appointment plugin for WooCommerce. One such customization is to change the price title based on the booking price to display a clear pricing structure on the product page.

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

Share It:

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