- changed status to resolved
We’ve been using WooCommerce Appointments for a few years now, and have done some modifications to it (e.g. supporting subscriptions for recurring appointments, sending additional reminder emails, sending custom Google Calendar event invites to assistants, etc)
In order to do that, we’ve had to add some hooks to the original plugin of yours.
The problem with this, as you might imagine, is that we now have to edit the plugin with each new version if we want to stay up to date, and re-apply our customizations.
I wanted to ask you if you could please add just a few one-liner hooks to some parts of the plugin. It would not only simplify updates, but maybe allow other people to create more powerful extensions for your great plugin :)
Here are the things I’m suggesting to add (Happy to send a pull request if there’s a repository that can be accessed, or provide you with access to my modified plugin version)
– Add a hook to WC_Appointment->save, so we can trigger other events when an appointment is saved (e.g. CRM Automations, Different Emails, tracking, etc) (woocommerce-appointments/includes/data-objects/class-wc-appointment.php around line 225)
example:
do_action( ‘woocommerce_after_’ . $this->object_type . ‘_object_save’, $this, $this->data_store, $get_changes );
– Add hook to WC_Appointment->maybe_schedule_event, to trigger other events (e.g. calendar automations) (woocommerce-appointments/includes/data-objects/class-wc-appointment.php around line 1668)
example:
do_action( ‘woocommerce_appointment_maybe_schedule_event’, $this, $type );
– Add a hook to WC_Appointments_Cache::clear_cron_hooks (woocommerce-appointments/includes/class-wc-appointments-cache.php around line 124) & WC_Appointment_Order_Manager->clear_cron_hooks, around line 899), so we can trigger other events externally, like cleaning hooks that have been set when saving an appointment in the previous suggested hook for sending emails, and others
example:
do_action( ‘woocommerce_appointment_clear_cron_hooks’, $post_id );
– Add a filter to WC_Appointment_Order_Manager->delete_post (for skipping lines 728-734) & WC_Appointment_Order_Manager->trash_post (for skipping lines 770-777). This is important for cases like subscriptions for recurring appointments, where deleting an appointment doesn’t mean that the order should be deleted.
– Adding filters to WC_Appointment_Order_Manager->maybe_update_order, to skip the “$order->update_status( $status );” on lines 1060 & 1078, for similar uses
Note: All the lines references are made on version 4.24.0, which is the latest one at the time.
Requested here.
Added with 4.25.0