In magento 2, How to get available sales rules value in the multiselect field in admin form


enter image description here

  • Is this a sales rules title? Nov 13, 2019 at 8:32
  • yes, its sales rule title Nov 13, 2019 at 9:39

1 Answer 1


Try below method to get available sales rules names in admin configuration


<field id="list_mode" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
   <label>Shopping cart rule</label>


namespace Vendor/Module\Model;

class ConfigSource implements \Magento\Framework\Option\ArrayInterface
    protected $ruleFactory;
    public function __construct(
        \Magento\SalesRule\Model\RuleFactory $ruleFactory
        $this->ruleFactory = $ruleFactory;

    public function toOptionArray()
        $rules = $this->ruleFactory->create()->getCollection();
        $data[] = [
            'value' => '',
            'label' => __('Please select')
        foreach ($rules as $key => $rule) {
            $data[$key] = [
                'value' => $rule->getRuleId(),
                'label' => $rule->getName()
        return $data;

Hope this will help you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.