Hide booking form from specific membership plans

Will you please provide a snippet that will hide the Book Now block from a specific membership plan? Thanks

Please try this PHP snippet. Please change 1,2,3 in the code snippet on the listing categories id where you want to hide the booking make form

add_filter(
	'hivepress/v1/templates/listing_view_page',
	function($template){
		if(!hivepress()->get_version('memberships')){
			return $template;
		}
		
		$membership = \HivePress\Models\Membership::query()->filter(['user' => get_current_user_id()])->get_first();

        if(!$membership || in_array($membership->get_plan__id(), [1,2,3])){
           	hivepress()->template->fetch_block($template, 'booking_make_form');
        }
		
		return $template;
	},
	10000
);
1 Like

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