Your cart is empty!
Initialization
public function onInitSaveSubscriptionOrder(mixed $cart) : void
Fires at the beginning of the saving process.
Description
Trigger hook to manipulate the cart instance while saving a subscription order. Here's possible to manipulate the cart instance.
This is the first hook that triggers after clicking the "Confirm Order" button.
Parameters
- $cart
-
(VikAppointmentsModelSubscrcart) The cart instance.
Return Value
None.
Example
Here's explained how it is possible to manipulate the selected subscription or the payment method.
/**
* Trigger hook to manipulate the cart instance.
*
* @param mixed $cart The cart instance.
*
* @return void
*/
public function onInitSaveSubscriptionOrder($cart)
{
// set payment with ID #5
$cart->setPayment(5);
// set subscription plan with ID #2
$cart->setSubscription(2);
// apply a custom discount
$cart->addDiscount(new VAPCartDiscount(
'custom-discount', 20.00, $percent = true
));
}
Changelog
Version | Description |
---|---|
1.7 | Introduced. |
Last Update: 2021-10-08 15:13
Helpful?