Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- { "rules__5_off_orders_over_90" : {
- "LABEL" : "$5 off Orders over $90",
- "PLUGIN" : "reaction rule",
- "REQUIRES" : [
- "commerce_payment",
- "rules",
- "commerce_line_item",
- "commerce_product_reference"
- ],
- "ON" : [ "commerce_product_calculate_sell_price" ],
- "IF" : [
- { "commerce_payment_order_balance_comparison" : {
- "commerce_order" : [ "site:current-cart-order" ],
- "operator" : "\u003E=",
- "value" : "9000"
- }
- }
- ],
- "DO" : [
- { "variable_add" : {
- "USING" : { "type" : "integer", "value" : "0" },
- "PROVIDE" : { "variable_added" : { "numproducts" : "Number of Products" } }
- }
- },
- { "LOOP" : {
- "USING" : { "list" : [ "site:current-cart-order:commerce-line-items" ] },
- "ITEM" : { "list_item" : "Current list item" },
- "DO" : [
- { "data_calc" : {
- "USING" : {
- "input_1" : [ "numproducts" ],
- "op" : "+",
- "input_2" : [ "list-item:quantity" ]
- },
- "PROVIDE" : { "result" : { "result" : "Calculation result" } }
- }
- },
- { "data_convert" : {
- "USING" : { "type" : "integer", "value" : [ "result" ] },
- "PROVIDE" : { "conversion_result" : { "conversion_result" : "Conversion result" } }
- }
- },
- { "data_set" : { "data" : [ "numproducts" ], "value" : [ "conversion-result" ] } }
- ]
- }
- },
- { "variable_add" : {
- "USING" : { "type" : "integer", "value" : "5" },
- "PROVIDE" : { "variable_added" : { "discounttotal" : "Total Discount" } }
- }
- },
- { "data_calc" : {
- "USING" : {
- "input_1" : [ "discounttotal" ],
- "op" : "\/",
- "input_2" : [ "numproducts" ]
- },
- "PROVIDE" : { "result" : { "result" : "Single discount Line Item" } }
- }
- },
- { "data_calc" : {
- "USING" : { "input_1" : [ "result" ], "op" : "*", "input_2" : "100" },
- "PROVIDE" : { "result" : { "curreny_safe" : "curreny_safe" } }
- }
- },
- { "commerce_line_item_unit_price_subtract" : {
- "commerce_line_item" : [ "commerce_line_item" ],
- "amount" : [ "curreny-safe" ],
- "component_name" : "discount",
- "round_mode" : "1"
- }
- }
- ]
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement