public function storeOrder($orderInfo)
 {
     Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] orderinfo: " . print_r($orderInfo, true));
     $order = new Cart66Order();
     $pre_string = isset($orderInfo['status']) && $orderInfo['status'] == 'checkout_pending' ? 'CP-' : 'MT-';
     $orderInfo['trans_id'] = empty($orderInfo['trans_id']) ? $pre_string . Cart66Common::getRandString() : $orderInfo['trans_id'];
     $orderInfo['ip'] = $_SERVER['REMOTE_ADDR'];
     if (Cart66Session::get('Cart66Promotion')) {
         $orderInfo['discount_amount'] = Cart66Session::get('Cart66Promotion')->getDiscountAmount(Cart66Session::get('Cart66Cart'));
     } else {
         $orderInfo['discount_amount'] = 0;
     }
     $order->setInfo($orderInfo);
     $order->setItems($this->getItems());
     $orderId = $order->save();
     //update the number of redemptions for the promotion code.
     if (Cart66Session::get('Cart66Promotion')) {
         Cart66Session::get('Cart66Promotion')->updateRedemptions();
     }
     $orderInfo['id'] = $orderId;
     do_action('cart66_after_order_saved', $orderInfo);
     return $orderId;
 }