Italian (Italy)

apply_filters_ref_array( 'vikappointments_switch_payment_save_order', bool $status, int &$id_payment, array &$payments )

Fires after fetching the payment method selected by the customer.


Description

Trigger hook to manipulate the selected method of payment. In case the total to pay is equals to 0.00, this hook won't be triggered.


Parameters

$status

(bool)  True on success, false otherwise.

&$id_payment

(int)  The ID of the payment to use. The $payments argument must own a payment record with that ID, otherwise an error will be thrown. It is possible to set the ID to 0 to skip the payment process.

&$payments

(array)  A list containing all the supported payments. The array must contain the payment that matches the ID of the selected method of payment. In case the ID is going to be assigned to an unpublished gateway, that payment must be pushed within the list.


Example

The following example explains how to pick a payment that is not contained within the list of available payments.

/**
 * Trigger event to manipulate the selected payment gateway.
 *
 * @param  boolean  $status       True on success, false otherwise.
 * @param  integer  &$id_payment  The selected payment gateways.
 * @param  array    &$payments    An array of available payments.
 */
add_filter('vikappointments_switch_payment_save_order', function($status, &$id_payment, &$payments)
{
    // take the payment with ID equals to 5, load event if unpublished ($strict = true)
    $new_payment = VikAppointments::getPayment($id = 5, $strict = false);

    // register payment within the list
    $payments[] = $new_payment;

    // switch selected payment
    $id_payment = 5;

    return $status;
}, 10, 3);

Changelog

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

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.