You are here

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

@inheritdoc

Overrides CustomerHandlerInterface::getCustomerTotalSpent

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

File

src/CustomerHandler.php, line 223

Class

CustomerHandler
Customer handler.

Namespace

Drupal\mailchimp_ecommerce

Code

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