Guest User

Untitled

a guest
Jan 17th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. if ( is_user_logged_in() ):
  2. $customer_orders = get_posts( array(
  3. 'numberposts' => - 1,
  4. 'meta_key' => '_customer_user',
  5. 'meta_value' => get_current_user_id(),
  6. 'post_type' => array( 'shop_order' ),
  7. 'post_status' => array( 'wc-completed' ),
  8. 'date_query' => array(
  9. 'after' => date('Y-m-d', strtotime('-90 days')),
  10. 'before' => date('Y-m-d', strtotime('now'))
  11. ) ) );
  12. $total = 0;
  13. foreach ( $customer_orders as $customer_order ) {
  14. $order = wc_get_order( $customer_order );
  15. print_r($customer_order);
  16. $total += $order->get_total();
  17. }
  18. echo 'Orders: ' . $total . '<br>';
  19. if ($total <= 5) {
  20. if( woo_reg_matured( $days_old = 30 ) ) {
  21. echo 'You are inactive with ' . $total . ' orders and account age over 30 days';
  22. return;
  23. }
  24. echo 'You are inactive with ' . $total . ' orders and account age under 30 days';
  25. return;
  26. }
  27. echo 'You are active with over 30 days age and ' . $total . ' orders';
  28. return;
  29. endif;
Add Comment
Please, Sign In to add comment