Winter Sale Winter Sale
Up to 50% off
Grab Amelia
Grab Amelia

Amelia Hooks Available in WordPress

Filters in WordPress are a type of callback function that can be defined by the user and are applied to certain values – strings, integers, objects, etc. It is a simple way to adjust code output without actually having to modify the code. Essentially, you add a given function on top of an existing one, to override the logic. Then, when the plugin is updated later, you won’t lose any of your changes.

You can get a detailed description of WordPress hooks here in WP Codex.

WordPress Actions provide a convenient way to “hook” into different plugins without changing their code. Basically, “actions” are user-defined functions, assigned to certain labels, that are called by the plugin core at defined moments of its execution.

Unlike filters, actions do not return any data, they are simply executed.

You can read more about using WordPress actions and assigning your functions to actions in WordPress Codex. Here, we will provide a list of actions defined in the Amelia plugin that you can use to customize it for your needs.

Content

Please note that using hooks requires a certain level of programming skills and included support refers only to advice.

Filters

amelia_manipulate_email_data

Users can use this filter to manipulate email data before Amelia sends email notifications.

$data that is passed to filter: email, subject, body, bcc, attachments.

Important: If you don’t want Amelia to send an email notification he needs to return the ‘skipSending’ param back with all other data

($data[‘skipSending’] = true;)

function example_callback( $data ) {
// do something here
$data['skipSending'] = true;
return $data;
}

add_filter( 'amelia_manipulate_email_data', 'example_callback', 10, 1 );

amelia_modify_payment_amount

Used to change the final calculated price for booking.

Example:

function example_callback( $price, $booking ) {
// change price 
return $price;
}

add_filter( 'amelia_modify_payment_amount', 'example_callback', 10, 2 );

amelia_before_stripe_payment

Users can change the data related to Stripe transactions. This data is used to create a payment intent in Stripe.

Example:

function example_callback( $stripeData ) {
// change stripe data before creating stripe payment 
return $stripeData;
}

add_filter( 'amelia_before_stripe_payment', 'example_callback', 10, 1 );

amelia_before_payment

Users can change the payment data before it is saved in the database.

Example:

function example_callback( $paymentData, $amount ) {
// change payment data
return $paymentData;
}

add_filter( 'amelia_before_payment', 'example_callback', 10, 2 );

amelia_get_modified_price

Used for changing the price of booking for WooCommerce orders.

Example:

function example_callback( $paymentAmount, $wcItemAmeliaCache, $bookableData ) {
// change price for woocommerce
return $paymentAmount;
}

add_filter( 'amelia_get_modified_price', 'example_callback', 10, 3 );

amelia_checkout_data

Users can change the customer data displayed on WooCommerce’s checkout page.

Example:

function example_callback( $data, $container, $wc_key ) {
// change the checkout data on woocommerce checkout page
// $data - array with billing_first_name, billing_last_name, billing_email 
// and billing_phone
return $data;
}

add_filter( 'amelia_checkout_data', 'example_callback', 10, 3 );

amelia/curlopt_ssl_verifypeer

Users can pass the SSL verification when activating the Amelia plugin if the SSL certificate is not set or if it has expired.

Example:

function example_callback() {
return 0; 
} 

add_filter( 'amelia/curlopt_ssl_verifypeer', 'example_callback', 10, 2 );

A dynamic placeholder filter

A filter that allows users to add any placeholder to a notification and replace it with its appropriate value using this filter. In the notification template, use:

%amelia_dynamic_placeholder_{nameOfPh}%

Example:

function example_callback( $data ) {
// return new placeholder
return 'custom data';
}

add_filter( 'amelia_dynamic_placeholder_{nameOfPh}', 'example_callback', 10, 1 );

Booking Status Filters

  • AmeliaAppointmentBookingCanceledFilter
  • AmeliaAppointmentBookingAddedFilter
  • AmeliaAppointmentBookingStatusUpdatedFilter
  • AmeliaEventBookingCanceledFilter
  • AmeliaEventBookingAddedFilter
  • AmeliaEventBookingStatusUpdatedFilter

These filters allow the users to change/add data being sent to the webhook.

Data sent:

$data = [‘event’/’appointment’ => $appointmentData, ‘bookings’ => $affectedBookings]

Example:

function example_callback( $data ) {
return $data; 
} 

add_filter( 'AmeliaAppointmentBookingAddedFilter', 'example_callback', 10, 1 );

Booking Status Headers Filters

  • AmeliaAppointmentBookingCanceledFilterHeader
  • AmeliaAppointmentBookingAddedFilterHeader
  • AmeliaAppointmentBookingStatusUpdatedFilterHeader
  • AmeliaEventBookingCanceledFilterHeader
  • AmeliaEventBookingAddedFilterHeader
  • AmeliaEventBookingStatusUpdatedFilterHeader

These filters allow the users to change/add data being sent to the webhook header.

Data sent:

$headers = [‘Content-Type:application/json’]; $data = [‘event’/’appointment’ => $appointmentData, ‘bookings’ => $affectedBookings];

Example:

function example_callback( $header, $data ) {
return $headers; 
} 

add_filter( 'AmeliaAppointmentBookingAddedFilterHeader', 'example_callback', 10, 2 );

CSV Export Filters

  • amelia_before_csv_export_appointments
  • amelia_before_csv_export_coupons
  • amelia_before_csv_export_customers amelia_before_csv_export_event
  • amelia_before_csv_export_payments

Users can add fields in the CSV export of appointments, coupons, customers, event attendees, and payments.

Example:

function export_appointments_hook( $row, $appointment, $separate ) {
        // $separate - whether bookings inside the same appointment are exported in separate rows or in one row
        $row['id'] = $appointment['id'];
        
        return $row;
}

add_filter( 'amelia_before_csv_export_appointments', 'export_appointments_hook', 10, 3 );

function export_coupons_hook( $row, $coupon ) {
        $row['id'] = $coupon['id'];
        
        return $row;
}

add_filter( 'amelia_before_csv_export_coupons', 'export_coupons_hook', 10, 2 );

Actions

AmeliaBookingAddedBeforeNotify

Users can perform actions after the booking is created but before post-booking actions are performed (sending notifications, adding events to Google/Outlook calendars, creating Zoom links, webhooks).

Example:

function example_callback( $data, $container ) {
// actions
}

add_action( 'AmeliaBookingAddedBeforeNotify', 'example_callback', 10, 2 );

AmeliaCustomerWPCreated

Used for actions after a WordPress user is created for an Amelia Customer.

Example:

function example_callback( $customerData, $container ) {
// actions
}

add_action( 'AmeliaCustomerWPCreated', 'example_callback', 10, 2 );

Post-Booking Actions (called at the beginning of the function)

  • AmeliaBookingCanceled
  • AmeliaBookingAdded
  • AmeliaBookingStatusUpdated

Users can perform actions after all the post-booking actions, except for the webhooks, are complete. This is called at the beginning of the function.

Example:

function example_callback( $reservation, $bookings, $container ) {
// actions
}

add_action( 'AmeliaBookingCanceled', 'example_callback', 10, 3 );

Post-Booking Actions (prior to the calling of webhooks)

  • AmeliaAppointmentBookingCanceled
  • AmeliaAppointmentBookingAdded
  • AmeliaAppointmentBookingStatusUpdated
  • AmeliaEventBookingCanceled
  • AmeliaEventBookingAdded
  • AmeliaEventBookingStatusUpdated

Users can perform actions after all the post-booking actions, except for webhooks, are complete. This is called just before the calling of webhooks. The data sent is a little modified here compared to the first call.

Example:

function example_callback( $reservation, $bookings, $container ) {
// actions
}

add_action( 'AmeliaAppointmentBookingCanceled', 'example_callback', 10, 3 );

Please note: This action is being called after the Booking Status Filter.

ameliaScriptsLoaded

Users can perform actions after all the scripts that Amelia uses are loaded (Paypal, Razor Pay, Google maps API…)

Example:

function example_callback( ) {
// actions
}

add_action( 'ameliaScriptsLoaded', 'example_callback', 10, 0 );