Jump to content

Change customer group after first order

Recommended Posts

Posted (edited)


I'm using a module to set a minimum order threshold for new customers. When they place their first order I want them moved from the New Customers Group to the Customers group, where the threshold will no longer apply for subsequent orders.omegle discord xender

How can I change a customer group like this? Seems like it should be easy with a little code? I suppose I could do a cron job database query nightly to update their group, but I was hoping to use a function and hook.

Edited by BeckettColt (see edit history)

Share this post

Link to post
Share on other sites

There are several possibilities.
The easiest way is to edit PaymentModule.php in ../classes/

Add an entry to the database after sending order_conf email, which is an order confirmation.


Find code:

if (Validate::isEmail($this->context->customer->email)) {
                                Mail::l('Order confirmation', (int)$order->id_lang),
                                $this->context->customer->firstname.' '.$this->context->customer->lastname,
                                null, _PS_MAIL_DIR_, false, (int)$order->id_shop

and add after:

Db::getInstance()->Execute('update '._DB_PREFIX_.'customer set id_default_group = 4 where id_customer = '.$this->context->customer->id;
Db::getInstance()->Execute('insert into '._DB_PREFIX_.'customer_group values('.$this->context->customer->id.',4)');

Change 4 to your customer group.

  • Like 1

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More