Change deposit amount

Hello! I have two questions!

  1. Is there a way to change the security deposit to a 50% deposit that isn’t refundable? As in, the client pays 50% of the total amount upfront and 50% at a later date?

  2. Is there a way to do emails to remind clients of there upcoming booking?

  1. Please try this PHP snippet but please note that it can require further customization. If Security Deposit is translated on your website then please change it on the string after translation
add_filter(
	'hivepress/v1/models/listing/cart',
	function($args, $listing){
		
		if(!$listing || !$listing->get_booking_deposit()){
			return $args;
		}
		
		if(isset($args['meta']['commission_fee'], $args['meta']['fees'], $args['meta']['price'])){
			unset($args['meta']['commission_fee']);
			
			foreach($args['meta']['fees'] as $fee => $fee_args){
				if('Security Deposit' === $fee_args['name']){
					$fee_args['amount'] = floatval($args['meta']['price']) / 2;
					$args['meta']['fees'][$fee] = $fee_args;
				}
			}
		}
		
		return $args;
	},
	1000,
	2
);
  1. Unfortunately there is no such feature but it is on the roadmap

What should that snippet do exactly?? I do not see any changes on the front end.

Is there a way to charge only the deposit, but to pay for the service?
The rest of the amount of the advertisement is not charged by the owner of the web portal.
Example:
service 100
deposit 50% = 50
the website charges the deposit = 50
The invoice is issued for 50
but the taxable amount is 50 , not 100 - 50 = 50

Please try to set any number as a security deposit for a listing. Then the security deposit will be recalculated to 50% of the listing price on each booking and the security deposit will not count to the vendor balance if you mean this as not refundable

Sorry, there’s no simple code snippet - this requires advanced customizations.

If customizations are required for your site, please try customizing it using the collection of code snippets Search · user:hivepress · GitHub and other developer resources, or consider hiring someone for custom work https://fwd.cx/hLhc73mQCD9R

I meant for the deposit to count towards the vendor balance. It is non refundable to the client that bought the booking. The deposit would be 50% of the total and only 50% would be left to be paid at a later date.

The above snippet should actually work this way, by default the security deposit is not added to the host balance because of the hidden “commission_fee” that equals to the deposit amount, but this snippet removes it, so the deposit should be added to the balance. Make sure that security deposits are enabled in HivePress/Settings/Bookings.

Perfect! Is there a way I can set the security deposit to a default 50% of the listing price and remove it from the attribute list when creating a listing?? I don’t want the hosts to set the security deposit.

Please try this PHP snippet. It will hide the booking deposit field for vendors

add_action('hivepress/v1/models/listing/create', function($listing_id) {
	if ( get_option( 'hp_booking_enable_deposit' ) ) {
		update_post_meta($listing_id, 'hp_booking_deposit', '1');	
	}
});

add_filter( 'hivepress/v1/models/listing/attributes', 'hide_deposit_attribute_custom', 1000 );
add_filter( 'hivepress/v1/models/vendor/attributes', 'hide_deposit_attribute_custom', 1000 );

function hide_deposit_attribute_custom($attributes){
	if(isset($attributes['booking_deposit'])){
		$attributes['booking_deposit']['editable'] = false;
	}
	return $attributes;
}

Thank you, but what about making it a default 50% for all the listings on the site?? Or does the first snippet do this automatically?

This would require further customizations (calculating 50%, setting it as default, and blocking the deposit edit field) - we received the customization request so I’ll reply there as soon as possible.

1 Like

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