Answers for "woocommerce get user id by email"

PHP
0

woocommerce get orders by user id

public function get_sum_of_paid_orders( int $user_id ): int {

        $customer_orders = [];
        foreach ( wc_get_is_paid_statuses() as $paid_status ) {
            $customer_orders += wc_get_orders( [
                'type'        => 'shop_order',
                'limit'       => - 1,
                'customer_id' => $user_id,
                'status'      => $paid_status,
            ] );
        }

        $total = 0;
        foreach ( $customer_orders as $order ) {
            $total += $order->get_total();

            // your code is here
        }

        return $total;
    }
Posted by: Guest on June-06-2021
0

woocommerce get user id by email

$user = get_user_by( 'email', '[email protected]' );
$userId = $user->ID;
Posted by: Guest on October-28-2021

Code answers related to "woocommerce get user id by email"

Browse Popular Code Answers by Language