[Skip to main content](#vessel-content)

#   Changing the user group after the 3rd purchase

##

- **[StudioPrzyLesie](/forum/user/31654-studioprzylesie "View StudioPrzyLesie's Profile")**
- [![StudioPrzyLesie's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/31654-studioprzylesie "View StudioPrzyLesie's Profile") Topic Author
- [ Offline](/forum/user/31654-studioprzylesie)

Less More

- Posts: 196
- Thank you received: 15
-
-

2 years 11 months ago [\#357378](#357378) by [StudioPrzyLesie](/forum/user/31654-studioprzylesie "View StudioPrzyLesie's Profile")  *[Changing the user group after the 3rd purchase](/forum/33-customers/907419-changing-the-user-group-after-the-3rd-purchase#357378 "Hi, Is it possible to configure it so that after placing the third order, the customer will be automatically transferred to another Joomla user group? So as to assign it to a group with a specific discount. Tom")* was created by *[StudioPrzyLesie](/forum/user/31654-studioprzylesie "View StudioPrzyLesie's Profile")*

Hi,
Is it possible to configure it so that after placing the third order, the customer will be automatically transferred to another Joomla user group? So as to assign it to a group with a specific discount.
Tom

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMzLWN1c3RvbWVycy85MDc0MTktY2hhbmdpbmctdGhlLXVzZXItZ3JvdXAtYWZ0ZXItdGhlLTNyZC1wdXJjaGFzZT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86584
- Thank you received: 14325
-
-

2 years 11 months ago [\#357382](#357382) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Changing the user group after the 3rd purchase](/forum/33-customers/907419-changing-the-user-group-after-the-3rd-purchase#357382 "Hi, Is it possible to configure it so that after placing the third order, the customer will be automatically transferred to another Joomla user group? So as to assign it to a group with a specific discount. Tom")*

Hi,

There is no option to do it.
However, you should be able to do it with a bit of coding and a mass action.
For example, you can create a mass action "order" with a trigger "after an order is updated" and with an action "run PHP code" with such code: Code:

$db = JFactory::getDBO(); $db-&gt;setQuery('SELECT count(order_id) FROM #__hikashop_order WHERE order_user_id={order_user_id} AND order_status IN ("confirmed", "shipped")'); $number_of_orders = $db-&gt;loadResult(); if($number_of_orders &gt;= 3) { $userClass = hikashop_get('class.user'); $hkUser = $userClass-&gt;get({order_user_id}); if(!empty($hkUser-&gt;user_cms_id)) { $user = clone(JFactory::getUser($hkUser-&gt;user_cms_id)); jimport('joomla.access.access'); $userGroups = JAccess::getGroupsByUser($hkUser-&gt;user_cms_id, true); $userGroups[] = XXX; $user-&gt;set('groups',$userGroups); $user-&gt;save(); } }

where XXX is the id of the user group you want to add to the user account.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMzLWN1c3RvbWVycy85MDc0MTktY2hhbmdpbmctdGhlLXVzZXItZ3JvdXAtYWZ0ZXItdGhlLTNyZC1wdXJjaGFzZT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[StudioPrzyLesie](/forum/user/31654-studioprzylesie "View StudioPrzyLesie's Profile")**
- [![StudioPrzyLesie's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/31654-studioprzylesie "View StudioPrzyLesie's Profile") Topic Author
- [ Offline](/forum/user/31654-studioprzylesie)

Less More

- Posts: 196
- Thank you received: 15
-
-

2 years 11 months ago [\#357399](#357399) by [StudioPrzyLesie](/forum/user/31654-studioprzylesie "View StudioPrzyLesie's Profile")  Replied by *[StudioPrzyLesie](/forum/user/31654-studioprzylesie "View StudioPrzyLesie's Profile")* on topic *[Changing the user group after the 3rd purchase](/forum/33-customers/907419-changing-the-user-group-after-the-3rd-purchase#357399 "Hi, Is it possible to configure it so that after placing the third order, the customer will be automatically transferred to another Joomla user group? So as to assign it to a group with a specific discount. Tom")*

Thank you, I will test ![:)](/media/kunena/emoticons/3.png ":)")
Tom

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMzLWN1c3RvbWVycy85MDc0MTktY2hhbmdpbmctdGhlLXVzZXItZ3JvdXAtYWZ0ZXItdGhlLTNyZC1wdXJjaGFzZT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.049 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
