Reveal Full Address on Payment

Hi Hivepress Team,

Since the listing does not show a complete full address. I would like to send a complete address of the appointment to users, but only once they have booked and paid ( with woocomerce) the listing. In other words, when “Hide exact address” option is checked, the full address should be revealed on payment. Please let me know if this is possible.

Thanks,

Please try this PHP snippet

add_filter(
	'hivepress/v1/templates/listing_view_page/blocks',
	function( $blocks, $template ) {
		$listing = $template->get_context('listing');
		
		if($listing){
			$booking_count = \HivePress\Models\Booking::query()->filter(
				[
					'listing' => $listing->get_id(),
					'user'       => get_current_user_id(),
					'status' => 'publish',
				]
			)->get_count();
			
			if($booking_count > 0){
				add_filter( 'option_hp_geolocation_hide_address', '__return_false' );
			}
			
		}
		
		return $blocks;
	},
	1000,
	2
);

You can also try adding the location token to the booking confirmation email %listing.location%, or hosts can add the hidden booking note for every listing (revealed only after the booking is confirmed). This note can be enabled in HivePress/Settings/Bookings section.

Awesome. I will give it a try

Thanks!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.