Create a new source model that returns all the customer groups including ‘NOT LOGGED IN’
<?php
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> <source_model>PHPCodez\Permission\Model\Config\Source\Group\Multiselect</source_model> </field>