You are here

public function CustomerHandler::getCustomerTotalOrders in Mailchimp E-Commerce 8

@inheritdoc

Overrides CustomerHandlerInterface::getCustomerTotalOrders

1 call to CustomerHandler::getCustomerTotalOrders()
CustomerHandler::buildCustomer in src/CustomerHandler.php
@inheritdoc

File

src/CustomerHandler.php, line 240

Class

CustomerHandler
Customer handler.

Namespace

Drupal\mailchimp_ecommerce

Code

public function getCustomerTotalOrders($email_address) {
  $query = $this->database
    ->select('mailchimp_ecommerce_customer', 'c')
    ->fields('c', [
    'orders_count',
  ])
    ->condition('mail', $email_address);
  $result = $query
    ->execute()
    ->fetch();
  if (!empty($result)) {
    return $result->orders_count;
  }
  return 0;
}