I've custom module of banner.

I want to add banner id as drop-down in price rules to select as custom field.

When, I select banner Id during sales rule then the particular banner must be activated on the website.

How can I do?


In order to add new field in Cart Price Rule, You need to create ui_component cause it created using it.

Follow Steps to add Custom Field in Cart Price Rule.


<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<fieldset name="rule_information" sortOrder="10">
    <field name="custom_field" formElement="select">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="source" xsi:type="string">sales_rule</item>
                <rule name="required-entry" xsi:type="boolean">true</rule>
            <label translate="true">Custom Field</label>
            <options class="Magento\Config\Model\Config\Source\Locale\Country"/>

Clear cache using bin/magento c:c, Than check.

  • Can I add this in my exisitng custom module or create new module? – Vinod Kumar May 28 '18 at 12:57
  • You can do this in existing module. – anonymous May 28 '18 at 12:58
  • but it is not working – Vinod Kumar May 28 '18 at 12:59
  • Did you clear cache ? What error are you getting ? – anonymous May 28 '18 at 13:00
  • Yes, cache clear. not getting any error on price rule section. – Vinod Kumar May 28 '18 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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