Vip Customer

We're looking to have VIP customers.
For example, any customer that has spend over a total of 1000,- becomes a VIP or Special member or whatever.

They will be put in a diffrent group, get diffrent newsletters, special discounts.

I think we have to use usergroups for this. Anyone has an idea what the best way to do would be

Add a decimal field to the users table for purchase_total of decimal(12,2)

Use a change_order_status hook and look at the value of the order. Add that to the purchase_total and save it to the users table. then check if the user is already in the group, if not, add them.

define('my_special_group', your_group_id);
define('my_special_amount', 1000);
function fn_my_changes_change_order_status($status_to, $status_from, $order_info) {
  $user_id = $order_info['user_id'];
  if( empty($user_id) )
    return;

$purchase_total = db_get_field(“SELECT purchase_total FROM ?:users WHERE user_id=?i”, $user_id);
db_query(“UPDATE ?:users SET purchase_total=?d WHERE user_id=?i”, $purchase_total += $order_info[‘subtotal’], $user_id);

if( !in_array(my_special_group, $_SESSION[‘auth’][‘usergroup_ids’]) && $purchase_total > my_special_amount )
fn_change_usergroup_status(‘F’, $user_id, my_special_group);
}

UNTESTED

Please pay attention to our addon

https://www.ecom-labs.com/ready-to-use-add-ons/cs-cart-loyalty-program-add-on.html