English (United Kingdom)
Knowledge Base  >  Vik Appointments  >  Hooks  >  Service  >  Choose Display Price

apply_filters( 'vikappointments_choose_display_service_price', bool $show, object $service )

Fires while checking whether the service price should be displayed.


Description 

This hook can be used to apply additional conditions to the visibility restrictions of the price of a service.

When this hook is triggered, the system already validated all the standard conditions.

This hook won't trigger when the price should be hidden by default, which means that at least one of these criteria is satisfied:

  • the service has not cost;
  • the customer owns an active subscription.

Parameters

$show

(bool)  False to hide the price.

$service

(object)  The service to check. 


Example

/**
 * This event can be used to apply additional conditions to the 
 * visibility restrictions. When this event is triggered, the
 * system already validated all the standard conditions.
 *
 * @param  boolean  $show     False to hide the service.
 * @param  object   $service  The service to check.
 */
add_filter('vikappointments_choose_display_service_price', function($show, $service)
{
    /**
     * @todo apply some custom validations
     */

    return $show;
}, 10, 2);

Changelog

Version Description
1.2 Introduced.
Last Update: 2021-08-12
Helpful?