Limited time discount Book Smarter This Christmas
Up to 50%Off

How can I use WordPress hooks for package purchases in Amelia

Amelia provides several hooks related to package purchases, allowing you to modify purchase data or run custom actions when packages are purchased, booked, updated, or deleted. These hooks help you extend Amelia safely without adjusting core plugin files.

Info Note

Hooks require programming knowledge, and support is limited to general guidance.

Package purchase added

How do I modify package purchase data before it is added?

amelia_before_package_customer_added_filter

Type: filter

Use this filter to modify package purchase data before it is added.

				
					function example($packageCustomer)
{
    // change package data
    return $packageCustomer;
}

add_filter('amelia_before_package_customer_added_filter', 'example', 10, 1);
				
			

How do I run code before a package purchase is added?

amelia_before_package_customer_added

Type: action

Runs before a package purchase is added.

				
					function example($packageCustomer)
{
    // do action
}

add_action('amelia_before_package_customer_added', 'example', 10, 1);
				
			

How do I run code after a package is booked from the front end?

amelia_after_package_booked_frontend

Type: action

Runs after a package is booked from the front end.

				
					function example($packageCustomer)
{
    // do action
}

add_action('amelia_after_package_booked_frontend', 'example', 10, 1);
				
			

How do I run code after a package is booked from the back end?

amelia_after_package_booked_backend

Type: action

Runs after a package is booked from the back end.

				
					function example($packageCustomer)
{
    // do action
}

add_action('amelia_after_package_booked_backend', 'example', 10, 1);
				
			

Package purchase status updated

How do I run code before a package purchase status is updated?

amelia_before_package_customer_status_updated

Type: action

Runs before the package purchase status is updated.

				
					function example($packageCustomer, $status)
{
    // do action
}

add_action('amelia_before_package_customer_status_updated', 'example', 10, 2);
				
			

How do I run code after a package purchase status is updated?

amelia_after_package_customer_status_updated

Type: action

Runs after the package purchase status is updated.

				
					function example($packageCustomer, $status)
{
    // do action
}

add_action('amelia_after_package_customer_status_updated', 'example', 10, 2);
				
			

Package purchase deleted

How do I run code before a package purchase is deleted?

amelia_before_package_customer_deleted

Type: action

Runs before a package purchase is deleted.

				
					function example($packageCustomer)
{
    // do action
}

add_action('amelia_before_package_customer_deleted', 'example', 10, 1);
				
			

How do I run code after a package purchase is deleted?

amelia_after_package_customer_deleted

Type: action

Runs after a package purchase is deleted.

				
					function example($packageCustomer)
{
    // do action
}

add_action('amelia_after_package_customer_deleted', 'example', 10, 1);
				
			

Package booking deleted

How do I run code before a package booking is deleted?

amelia_before_package_booking_deleted

Type: action

Runs before a package booking is deleted from the back end.

				
					function example($appointment, $removedBooking)
{
    // do action
}

add_action('amelia_before_package_booking_deleted', 'example', 10, 2);
				
			

How do I run code after a package booking is deleted?

amelia_after_package_booking_deleted

Type: action

Runs after a package booking is deleted from the back end.

				
					function example($appointment, $removedBooking)
{
    // do action
}

add_action('amelia_after_package_booking_deleted', 'example', 10, 2);