Magento 2 Include NOT LOGGED IN Customer Group System Configuration

Create a new source model that returns all the customer groups including ‘NOT LOGGED IN’

namespace PHPCodez\Permission\Model\Config\Source\Group;
use \Magento\Customer\Model\ResourceModel\Group\Collection;

class Multiselect implements \Magento\Framework\Option\ArrayInterface {

protected $_customerGroup;

protected $_options;

public function __construct( Collection $customerGroup ) {
$this->_customerGroup = $customerGroup; 

public function toOptionArray() {
if (!$this->_options) {
$this->_options = $this->_customerGroup->toOptionArray();
return $this->_options;

And add the folowing in system.xml file

<field id="hideprice" translate="label" type="multiselect" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Hide Price For</label>

Leave a Reply

Your email address will not be published. Required fields are marked *