I want to create a cart price rule condition that checks for a cart item's buyRequest object to act upon it accordingly. A rule should only be applied when that buyRequest contains a certain value.
I followed this howto to create a custom condition for cart price rules.
However the condition created shows up in the "conditions" section of the rule.
But I need my condition in the "actions" part of the rule as a cart item condition:
I feel like I am so close but I can't quite figure it out. I also browsed through the core's code for the existing 3 cart item attributes ("Price in cart", "Quantity in cart" and "Row total in cart") but could not figure out what they are doing different to show up down there.
Any hint is welcome, thank you.
Best Answer
To add new conditions under Cart Item Attribute you need to follow the below steps:
Step 1: Create registration.php under
with below content:
Step 2: Create module.xml under
with content:
Step 3: Create di.xml under:
with content:
Step 4: Create Product.php under
with content:
Thats it!!!! Run all the necessary commands and check in admin.