Advertisement
cloudtuts

WooCommerce自動完成所有付款之訂單

Oct 25th, 2018
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.44 KB | None | 0 0
  1.             add_filter( 'woocommerce_payment_complete_order_status', 'silkwave_autocomplete_paid_orders', 10, 2 );
  2.  
  3.             function silkwave_autocomplete_paid_orders( $order_status, $order_id ) {
  4.                 $order = new WC_Order( $order_id );
  5.                 if ( $order_status == 'processing' && ( $order->get_status() == 'on-hold' || $order->get_status() == 'pending' || $order->get_status() == 'failed' ) ) {
  6.                     return 'completed';
  7.                 }
  8.  
  9.                 return $order_status;
  10.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement