Jump to content

Adding a group automatically activates that group for all carriers.


zunxunz

Recommended Posts

Adding a group automatically activates that group for all carriers.

This seems like undesirable behaviour. I'm using groups to 'restrict' users from being able to use certain carriers, if I now add a new group and add users, they suddenly can use those carriers and I have to update all the carriers.

Link to comment
Share on other sites

6 hours ago, zunxunz said:

Adding a group automatically activates that group for all carriers.

This seems like undesirable behaviour. I'm using groups to 'restrict' users from being able to use certain carriers, if I now add a new group and add users, they suddenly can use those carriers and I have to update all the carriers.

When you add a new group in PrestaShop, it’s automatically activated for all carriers by default.
This is actually the intended core behaviour — but as you’ve noticed, it can be problematic if you use groups specifically to restrict carrier access.

The logic behind it is that PrestaShop assumes new groups should have “full” store access unless you manually restrict them. Unfortunately, this means every time you create a new group, you have to go through each carrier and manually uncheck it for that group.

There’s no setting in the Back Office to change this default, so your options are:

  • Manual update – after creating a group, immediately edit each carrier and remove that group.
  • Core override / module – change the default so new groups have no carriers assigned unless you explicitly allow them. This would require a small override to the group creation process in the back office.

here is some sql to take pain out of update all carriers after you add new group:

One-time cleanup right after you create the group (by id_group)
-- Replace ps_ if your prefix is different
-- 1) Set the new group's ID
SET @group_id := 123; -- <-- put the id_group of the new group here

-- 2) (Optional) sanity check: see the group name(s)
SELECT gl.name
FROM ps_group_lang gl
WHERE gl.id_group = @group_id;

-- 3) Remove auto-added carrier permissions for this group
DELETE cg
FROM ps_carrier_group cg
WHERE cg.id_group = @group_id;

 

Link to comment
Share on other sites

On 8/12/2025 at 8:53 PM, El Patron said:

When you add a new group in PrestaShop, it’s automatically activated for all carriers by default.
This is actually the intended core behaviour — but as you’ve noticed, it can be problematic if you use groups specifically to restrict carrier access.

The logic behind it is that PrestaShop assumes new groups should have “full” store access unless you manually restrict them. Unfortunately, this means every time you create a new group, you have to go through each carrier and manually uncheck it for that group.

There’s no setting in the Back Office to change this default, so your options are:

  • Manual update – after creating a group, immediately edit each carrier and remove that group.
  • Core override / module – change the default so new groups have no carriers assigned unless you explicitly allow them. This would require a small override to the group creation process in the back office.

here is some sql to take pain out of update all carriers after you add ne

On 7/2/2025 at 1:51 PM, Knowband Plugins said:

Override the class and change to the above line to below, if $this->memcached->getVersion() does not return anything, is not connected. 

$memcached_versions = $this->memcached->getVersion() ? $this->memcached->getVersion() : array();

$this->is_connected = in_array('255.255.255', $memcached_versions, true) === false;

 

w group:

One-time cleanup right after you create the group (by id_group)
-- Replace ps_ if your prefix is different
-- 1) Set the new group's ID
SET @group_id := 123; -- <-- put the id_group of the new group here

-- 2) (Optional) sanity check: see the group name(s)
SELECT gl.name
FROM ps_group_lang gl
WHERE gl.id_group = @group_id;

-- 3) Remove auto-added carrier permissions for this group
DELETE cg
FROM ps_carrier_group cg
WHERE cg.id_group = @group_id;

 

Thank you for your suggestion. After some more research I've opted for the solution below in stead. This prevents adding new groups to all carriers, in stead of removing them afterwards.

It would be good if this would become an 'optional' setting in Prestashop.

Override the Group class.

<?php

class Group extends GroupCore
{

    public function add($autodate = true, $null_values = false)
    {
        Configuration::updateGlobalValue('PS_GROUP_FEATURE_ACTIVE', '1');
        if (parent::add($autodate, $null_values)) {
            Category::setNewGroupForHome((int) $this->id);
            // Carrier::assignGroupToAllCarriers((int) $this->id);


            return true;
        }

        return false;
    }

}

 

  • Like 1
Link to comment
Share on other sites

1 hour ago, zunxunz said:

Thank you for your suggestion. After some more research I've opted for the solution below in stead. This prevents adding new groups to all carriers, in stead of removing them afterwards.

It would be good if this would become an 'optional' setting in Prestashop.

Override the Group class.

good job!  it's a great idea to create feature request, I should do this more often or at least once.  :)

 

 

How to open a Feature Request on PrestaShop GitHub

  • Go to the PrestaShop Issues page.
  • Click the green “New issue” button (top right).

You’ll see a list of templates:

  • Bug report
  • Feature request
  • Improvement suggestion
  • (sometimes “feature request” and “improvement” are merged depending on their repo settings).

Select Feature request.

If it doesn’t appear, choose “Open a blank issue” and then label it yourself as Feature request.

Fill in the template:

  • Title: Short, clear description of the feature.
  • Problem: Why it’s needed / what it solves.
  • Proposed solution: How it could work.
  • Alternatives: If any.
  • Additional details: Screenshots, links, use cases.

Submit the issue.

Edited by El Patron (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...