How can I use WordPress hooks for payment gateways in Amelia
Amelia provides gateway-specific hooks that allow you to modify payment data or run custom actions when payments are processed through supported payment gateways. These hooks let you adjust gateway behavior without modifying core plugin files.
Hooks require programming knowledge, and support is limited to general guidance.
WooCommerce
How do I modify appointment data before it is added to the WooCommerce cart?
amelia_before_wc_cart_filter
Type: filter
Use this filter to modify appointment data before it is added to the WooCommerce cart.
function example($appointmentData)
{
// change appointment data
return $appointmentData;
}
add_filter('amelia_before_wc_cart_filter', 'example', 10, 1);
How do I run code before an appointment is added to the WooCommerce cart?
amelia_before_wc_cart
Type: action
Runs before an appointment is added to the WooCommerce cart.
function example($appointmentData)
{
// do action
}
add_action('amelia_before_wc_cart', 'example', 10, 1);
How do I modify WooCommerce products returned to the back end?
amelia_get_wc_products_filter
Type: filter
Use this filter to modify WooCommerce products returned to the back end.
function example($products)
{
// change products
return $products;
}
add_filter('amelia_get_wc_products_filter', 'example', 10, 1);
How do I run code before WooCommerce products are retrieved?
amelia_get_wc_products
Type: action
Runs before WooCommerce products are retrieved to the back end.
function example($products)
{
// do action
}
add_action('amelia_get_wc_products', 'example', 10, 1);
How do I modify checkout data sent to WooCommerce?
amelia_checkout_data
Type: filter
Use this filter to modify checkout data such as billing details before WooCommerce checkout is processed.
function example($data, $container, $wc_key)
{
return $data;
}
add_filter('amelia_checkout_data', 'example', 10, 3);
How do I modify the payment amount for WooCommerce?
amelia_get_modified_price
Type: filter
Use this filter to modify the final payment amount for WooCommerce.
function example($paymentAmount, $wcItemAmeliaCache, $bookableData)
{
return $paymentAmount;
}
add_filter('amelia_get_modified_price', 'example', 10, 3);
How do I modify the WooCommerce redirect page?
amelia_wc_redirect_page
Type: filter
Use this filter to modify the WooCommerce redirect URL, such as the cart or checkout page.
function example($redirectUrl, $appointmentData)
{
return $redirectUrl;
}
add_filter('amelia_wc_redirect_page', 'example', 10, 2);
Mollie
How do I modify booking data before the Mollie redirect URL is returned?
amelia_before_mollie_redirect_filter
Type: filter
Use this filter to modify booking data before the Mollie redirect URL is returned.
function example($bookingData)
{
// change booking data
return $bookingData;
}
add_filter('amelia_before_mollie_redirect_filter', 'example', 10, 1);
How do I run code before the Mollie redirect URL is returned?
amelia_before_mollie_redirect
Type: action
Runs before the Mollie redirect URL is returned.
function example($bookingData)
{
// do action
}
add_action('amelia_before_mollie_redirect', 'example', 10, 1);
PayPal
How do I modify the payment amount before PayPal is executed?
amelia_before_paypal_execute_filter
Type: filter
Use this filter to modify the payment amount before PayPal payment is executed.
function example($paymentAmount, $reservation)
{
return $paymentAmount;
}
add_filter('amelia_before_paypal_execute_filter', 'example', 10, 2);
How do I run code before PayPal is executed?
amelia_before_paypal_execute
Type: action
Runs before the PayPal payment is executed.
function example($paymentAmount, $reservation)
{
// do action
}
add_action('amelia_before_paypal_execute', 'example', 10, 2);
How do I modify the PayPal response after execution?
amelia_after_paypal_execute_filter
Type: filter
Use this filter to modify the PayPal response after the payment is executed.
function example($response, $reservation)
{
return $response;
}
add_filter('amelia_after_paypal_execute_filter', 'example', 10, 2);
How do I run code after PayPal is executed?
amelia_after_paypal_execute
Type: action
Runs after the PayPal payment is executed.
function example($response, $reservation)
{
// do action
}
add_action('amelia_after_paypal_execute', 'example', 10, 2);
Stripe
How do I modify Stripe data before a payment is executed?
amelia_before_stripe_payment
Type: filter
Use this filter to modify Stripe data before the payment is executed.
function example_callback($stripeData)
{
return $stripeData;
}
add_filter('amelia_before_stripe_payment', 'example_callback', 10, 1);
Razorpay
How do I modify order data before Razorpay is executed?
amelia_before_razorpay_execute_filter
Type: filter
Use this filter to modify order data before the Razorpay payment is executed.
function example($orderData, $reservation)
{
return $orderData;
}
add_filter('amelia_before_razorpay_execute_filter', 'example', 10, 2);
How do I run code before Razorpay is executed?
amelia_before_razorpay_execute
Type: action
Runs before the Razorpay payment is executed.
function example($orderData, $reservation)
{
// do action
}
add_action('amelia_before_razorpay_execute', 'example', 10, 2);
How do I modify the Razorpay response after execution?
amelia_after_razorpay_execute_filter
Type: filter
Use this filter to modify the Razorpay response after the payment is executed.
function example($data, $reservation)
{
return $data;
}
add_filter('amelia_after_razorpay_execute_filter', 'example', 10, 2);
How do I run code after Razorpay is executed?
amelia_after_razorpay_execute
Type: action
Runs after the Razorpay payment is executed.
function example($response, $reservation)
{
// do action
}
add_action('amelia_after_razorpay_execute', 'example', 10, 2);