如何根据法规隐藏Woocommerce订单列表中的订单

时间:2017-11-30 10:20:34

标签: woocommerce

在管理方显示的订单列表中的woo-commerce中,是否可以自动隐藏或删除所有尚未完成状态或待处理状态的订单? 非常感谢

2 个答案:

答案 0 :(得分:0)

找到了解决方案!

 
 canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean> {
    return new Promise((resolve, reject) => {
    
    // Check if the authService returns an Observable or a Promise
    
    /**
      if returns a promise change for this:
      
      this.authService.isAuthenticated.then((isAuth) => {
        if  (isAuth) {
          resolve(true);
        } else {
          this.router.navigate(['Landing']);
        }
      })
      
      */
      
      /**
       if returns a Observable change for this:
      
      this.authService.isAuthenticated.subscribe((isAuth) => {
        if  (isAuth) {
          resolve(true);
        } else {
          this.router.navigate(['Landing']);
        }
      })
      */
      if  (this.authService.isAuthenticated) {
        resolve(true);
      } else {
        this.router.navigate(['Landing']);
      }
   
     
    })
 }
    

答案 1 :(得分:0)

您好,请检查以下代码,以便做正确的事情

add_filter('woocommerce_admin_order_actions','wdm_verify_product_limitation',5,2);
function wdm_verify_product_limitation( $actions, $the_order ){
    if ( $the_order->has_status( array('complete') ) ) {
        unset($actions['pending']);
        unset($actions['on-hold']);
    }
   return $actions;
}

希望这有助于解决您的问题

谢谢。