Last active
February 10, 2022 03:03
-
-
Save growdev/8674326 to your computer and use it in GitHub Desktop.
WooCommerce Payment Gateway actions after successful order.
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 | |
// Add a note to the order. Put return code here if needed. | |
$order->add_order_note( __('Payment completed', 'woocommerce') ); | |
// Mark the order as complete | |
$order->payment_complete(); | |
// Empty the cart | |
$woocommerce->cart->empty_cart(); | |
// Empty awaiting payment session | |
unset( $woocommerce->session->order_awaiting_payment ); | |
// Return thank you redirect | |
return array( | |
'result' => 'success', | |
'redirect' => $this->get_return_url( $order ) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment