Hello Magento Friends,

Customization is the centerpiece of the Magento framework. In this tutorial, I am going to explain How to Add Custom Options for the Action field of the Cart Price Rule Form in Magento 2.

Cart Price Rules are created when you want to offer any discount to customers. Admin needs to create cart price rules and apply the conditions and actions from the Magento backend.

Note: Track all the activities performed by your admin users by installing Magento 2 Admin Action Log.

Magento 2 provides four default actions for the apply field in the cart price rule.

cart price rule action

However, if the default options don’t match your requirements, you can add your custom options too in the actions apply field of cart price rule in Magento 2. Let’s check how

Steps to Add Custom Options in Action Apply Field of Cart Price Rule Form in Magento 2:

Step 1: Add di.xml file for the plugin in the following file path

app\code\Vendor\Extension\etc\adminhtml

Now, add the code as follows

Step 2: Create plugin file Valueprovider.php in the below file path to add custom option in action field dropdown

app\code\Vendor\Extension\Plugin\Rule\Metadata

Then add the below-mentioned piece of code

Conclusion:

Accordingly, you can add custom options to apply field dropdown in the cart price rule actions tab of Magento 2. In case you are unable to add, feel free to reach me through the comments. Share the article with the ones who are in search of cart price rule customization.

Happy Coding!

Click to rate this post!
[Total: 6 Average: 4.3]