[Appointments+] Appointments+ set deposit required amount per service

My client needs the ability to set a specific deposit % per service. The option currently runs across all services and as they have one rather expensive service on offer they need the ability to set this deposit to 10% instead of the current 50% which is global.
Any help would be greatly appreciated.

Thanks
Michael

  • Adam Czajczyk

    Hello Michael,

    I hope you're doing fine today!

    This is possible with an additional code snippet. Take a look at this, please:

    <?php 
    
    add_filter( 'app_paypal_amount', 'wpmu_partial_deposit_for_service', 9, 2);
    function wpmu_partial_deposit_for_service( $paypal_price, $service ) {
    
    	if ( $service == 3 ) {
    		$paypal_price = 2;
    	}
    
    	return $paypal_price;
    }

    You will want to adjust two values first. A number in this line

    if ( $service == 3 ) {

    is an ID of a service that you wish to affect. To find it, go to the "Appointments -> Services" page in site's back-end and then "right-click" (or Mac equivalent) on an "Edit" link for that service and select "Inspect Element" tool.

    That should open a source code where you should see an element with a class "row-actions" above the link code. Click on an arrow to expand the node (if it's not yet expanded) and you should see a span with a class ID. The number there is your ID to be used in the aforementioned line of my code, replacing current "3" value.

    The second think you'd wish to change would be this line:

    $paypal_price = 2;

    The value here is a price you wish to actually charge (in this case a deposit) for this service; that value is currency-independent so whatever number you put there, it will be exactly that amount in the current currency that you got set.

    Instead of putting a fixed price there (like in above example) you can also put some calculation there instead.

    Once adjusted, the code can be applied to the site as follows:

    - create an empty file with a .php extension (for example: "appointments-custom-service-deposit.php":wink:
    - copy and paste adjusted code into it
    - save the file and upload it to the following folder of your Wordpress install:

    /wp-content/mu-plugins

    If there's no "mu-plugins" folder inside "wp-content" folder, just create an empty one.

    I hope that helps!

    Best regards,
    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.