Advertisement
Guest User

Untitled

a guest
May 20th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. function wfocu_remove_drip_actions() {
  2. if ( class_exists( 'WC_Drip_Events' ) ) {
  3. $drip_event = WC_Drip_Events::get_instance();
  4. remove_action( 'woocommerce_payment_complete', array( $drip_event, 'new_order' ) );
  5. add_action( 'woocommerce_thankyou', 'wfocu_run_drip_on_thankyou', 10, 1 );
  6. }
  7. }
  8.  
  9. function wfocu_run_drip_on_thankyou( $order_id ) {
  10. $order = wc_get_order( $order_id );
  11. if ( class_exists( 'WC_Drip_Events' ) && $order->has_status( wc_get_is_paid_statuses() ) ) {
  12. $drip_event = WC_Drip_Events::get_instance();
  13. $drip_event->new_order( $order_id );
  14. }
  15. }
  16.  
  17. add_action( 'wp', 'wfocu_remove_drip_actions', 999 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement