Here is the code snippet by which we can create Magento shopping cart price rule, i.e the rule which is applied on shopping cart while customer add his/her product to shopping cart.
shopping cart price rule can be divided in 3 parts
1. Information of the rule
2. Condition that will be applied on the rule.
3. Action that will be taken.