Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ( is_user_logged_in() ):
- $customer_orders = get_posts( array(
- 'numberposts' => - 1,
- 'meta_key' => '_customer_user',
- 'meta_value' => get_current_user_id(),
- 'post_type' => array( 'shop_order' ),
- 'post_status' => array( 'wc-completed' ),
- 'date_query' => array(
- 'after' => date('Y-m-d', strtotime('-90 days')),
- 'before' => date('Y-m-d', strtotime('now'))
- ) ) );
- $total = 0;
- foreach ( $customer_orders as $customer_order ) {
- $order = wc_get_order( $customer_order );
- print_r($customer_order);
- $total += $order->get_total();
- }
- echo 'Orders: ' . $total . '<br>';
- if ($total <= 5) {
- if( woo_reg_matured( $days_old = 30 ) ) {
- echo 'You are inactive with ' . $total . ' orders and account age over 30 days';
- return;
- }
- echo 'You are inactive with ' . $total . ' orders and account age under 30 days';
- return;
- }
- echo 'You are active with over 30 days age and ' . $total . ' orders';
- return;
- endif;
Add Comment
Please, Sign In to add comment