Guest User

Untitled

a guest
Oct 16th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. public function process_payment( $order_id ) {
  2. $order = wc_get_order( $order_id );
  3. $cart_total = WC()->cart->total;
  4. // code to capture payment and status
  5. if(success){
  6. $order->payment_complete();
  7. return array(
  8. 'result' => 'success',
  9. 'redirect' => $this->get_return_url( $order )
  10. );
  11. }
  12. else{
  13. wc_add_notice( "Unable to process.", 'error' );
  14. return array(
  15. 'result' => 'failure',
  16. 'message' => 'Unable to process.',
  17. );
  18. }
  19.  
  20. }
Add Comment
Please, Sign In to add comment