Created
September 6, 2022 12:31
-
-
Save verygoodplugins/4c53b481f3494725ca84f377f8dcda89 to your computer and use it in GitHub Desktop.
Sync YITH Request A Quote pending orders to ActiveCampaign Deep Data as if they'd already been paid for
This file contains 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 | |
// Sync YITH Request A Quote pending orders to AC as if they'd been paid. | |
function add_custom_paid_status( $statuses ) { | |
$statuses[] = 'ywraq-new'; | |
$statuses[] = 'ywraq-pending'; | |
return $statuses; | |
} | |
add_filter( 'wpf_woocommerce_order_statuses', 'add_custom_paid_status' ); | |
add_filter( 'woocommerce_order_is_paid_statuses', 'add_custom_paid_status' ); | |
function schedule_order_sync( $order_id ) { | |
wp_schedule_single_event( time() + MINUTE_IN_SECONDS, 'wpf_handle_async_checkout_fallback', array( $order_id ) ); | |
} | |
add_action( 'woocommerce_order_status_ywraq-new', 'schedule_order_sync' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment