Successful checkout change user group

I’m wondering if i can hook in a small script to when a user places an order with a products in certain category i can change there user group. Is this possible with the hooks?

Absolutely…



For 2.0.x…



In addons/my_changes/controllers/customer/orders.post.php

Add some conditional code (based on $mode == ‘details’ && $_REQUEST[‘confirmation’] == ‘Y’ && !empty($_SESSION[‘auth’][‘user_id’]) )



Inside the condition, do a DB query to update the usergroup_links table to create (or REPLACE) an entry for the usergroup_id for the group you want to add them to. You get the user_id from $_SESSION[‘auth’][‘user_id’]. But if that’s empty then they’re not a registered user.