You are here

function uc_cart_uc_checkout_complete in Ubercart 8.4

Implements hook_uc_checkout_complete().

Sends basic e-mail notifications if Rules is not installed.

File

uc_cart/uc_cart.module, line 241
Handles all things concerning Ubercart's shopping cart.

Code

function uc_cart_uc_checkout_complete($order) {

  // @todo Uncomment this conditional when Rules actually works.

  //if (!\Drupal::moduleHandler()->moduleExists('rules')) {
  \Drupal::moduleHandler()
    ->loadInclude('uc_order', 'inc', 'uc_order.rules');
  $cart_config = \Drupal::config('uc_cart.settings');
  if ($cart_config
    ->get('checkout_email_customer')) {
    $subject = t('Your Order at @store', [
      '@store' => uc_store_name(),
    ]);
    uc_order_action_email_invoice($order, uc_store_email_from(), $order
      ->getEmail(), $subject, 'customer', 'checkout-mail');
  }
  if ($cart_config
    ->get('checkout_email_admin')) {
    $subject = t('New Order at @store', [
      '@store' => uc_store_name(),
    ]);
    uc_order_action_email_invoice($order, uc_store_email_from(), uc_store_email(), $subject, 'admin', 'admin-mail');
  }

  //}
}