Created
September 20, 2023 11:52
-
-
Save LaxusCroco/e89b30b49a2c3f3f1154bb93c5ded974 to your computer and use it in GitHub Desktop.
Replace the ID of the service in $to_skip = array( 164 ); and $to_skip = array( 13723 ); with the needed service ID.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//update appointment status | |
function __complete_appointment( $appointment_id ) { | |
if ( ! isset( $appointment_id ) ) { | |
return; | |
} | |
$appointment = jet_apb()->db->get_appointment_by( 'ID', $appointment_id ); | |
if ( ! $appointment ) { | |
return; | |
} | |
jet_apb()->db->appointments->update( | |
array( 'status' => 'completed', ), | |
array( 'ID' => $appointment_id, ) | |
); | |
jet_apb()->db->maybe_exclude_appointment_date( $appointment ); | |
} | |
//disable WC-JetAppointment integration in JetEngine for specified services | |
add_action( 'jet-apb/form/notification/success', function( $appointments ) { | |
//IDs of services that should not be WC integrated | |
$to_skip = array( 164 ); | |
foreach( $appointments as $item ) { | |
if ( in_array( $item['service'], $to_skip ) ) { | |
remove_action( 'jet-apb/form/notification/success', array( jet_apb()->wc, 'process_wc_notification' ), 10 ); | |
__complete_appointment( $item['ID'] ); | |
} | |
} | |
}, 0 ); | |
////disable WC-JetAppointment integration in JetFormBuilder for specified services | |
add_action( 'jet-apb/jet-fb/action/success', function( $appointments ) { | |
//IDs of services that should not be WC integrated | |
$to_skip = array( 13723 ); | |
foreach( $appointments as $item ) { | |
if ( in_array( $item['service'], $to_skip ) ) { | |
remove_action( 'jet-apb/jet-fb/action/success', array( jet_apb()->wc, 'process_wc_notification' ), 10 ); | |
__complete_appointment( $item['ID'] ); | |
} | |
} | |
}, 0 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment