Italian (Italy)

apply_filters_ref_array( 'vikappointments_prepare_fields_save_order', bool $status, array &$fields, array &$args )

Fires after fetching the custom fields set in request.


Description

Trigger hook to manipulate the custom fields array and the billing information of the customer, extrapolated through the rules of the custom fields.

In case you are using a third-party plugin to collect the details of the customer, it is possible to inject into $args array all the information that you wish to register.


Parameters

$status

(bool)  True on success, false otherwise.

&$fields

(array)  An associative array containing the custom fields entered by the customer. The array keys match the names of the custom fields, the values match the details specified by the customer instead.

&$args

(array)  An associative array containing the billing details of the customer.


Example

Assuming that no custom fields are used, the system auto-inject the phone number of the customer into the array holding the billing details.

/**
 * Trigger event to manipulate the custom fields array and the
 * billing information of the customer, extrapolated from the rules
 * of the custom fields.
 *
 * @param  boolean  $status   True on success, false otherwise.
 * @param  array    &$fields  The custom fields values.
 * @param  array    &$args    The billing array.
 */
add_filter('vikappointments_prepare_fields_save_order', function($status, &$fields, &$args)
{
    // get details of the current user
    $user = wp_get_current_user();

    if (!$user)
    {
        return false;
    }

    // assume that the phone number is contained within the details of the currently logged-in user
    if (empty($args['purchaser_phone']))
    {
        $args['purchaser_phone'] = $user->phone;
    }

    return $status;
}, 10, 3);

Changelog

Version Description
1.0 Introduced.
Ultimo aggiornamento: 2021-08-05
Utile?
Potrebbe interessarti:

Questo sito web utilizza i cookie

Questo sito web utilizza cookie e tecnologie simili. Alcune di queste tecnologie sono necessarie per il corretto funzionamento del sito web (essenziali). Altre tecnologie sono utilizzate per valutare il comportamento degli utenti (analisi), per integrare media esterni o per scopi pubblicitari. Se l'utente accetta, queste tecnologie vengono attivate. I dettagli sono riportati nella Privacy Policy. Da questa stessa pagina è inoltre possibile aggiornare/revocare il consenso. Se non si fornisce il consenso, verranno attivati solo i cookie con funzioni essenziali.

Sul nostro sito web utilizziamo tecnologie provenienti dagli Stati Uniti. Pertanto, se acconsentite, acconsentite anche al trasferimento dei vostri dati negli Stati Uniti. Desideriamo sottolineare che gli Stati Uniti non hanno un livello di protezione dei dati paragonabile a quello dell'Unione Europea e che qualsiasi azienda statunitense può essere obbligata dalle autorità statali a consegnare i vostri dati senza che voi abbiate alcuno strumento efficace di protezione legale contro questo.