Tags/topics: 
1
Answers
Vote up!
0
Vote down!

Slightly more complex coupon

My client is a book publisher/online book retailer. I need to extend the commerce coupon functionality by adding two additional fields to the percentage discount coupon. Besides the percentage off field, I need to be able to offer free shipping with a coupon. I also need to be able to limit the discount to specific items.

Examples:

Scenario 1: Blanket 10% across the board on all products (default percentage discount coupon functionality)
Scenario 2: Blanket 10% across the board on all products + free shipping
Scenario 3: 15% on products that are published by the client (tracked using a CCK field)

Create new rule, have multiple rules, modify existing rule? Any pointers, tutorials, links, ideas, etc. are appreciated.

Asked by: torq
on July 24, 2012

1 Answer

Vote up!
0
Vote down!

Tried this rule... didn't work.

{ "rules_free_shipping_coupon" : {
    "LABEL" : "Free Shipping Coupon",
    "PLUGIN" : "reaction rule",
    "TAGS" : [ "discounts", "shipping" ],
    "REQUIRES" : [ "rules", "commerce_shipping", "commerce_coupon" ],
    "ON" : [ "commerce_coupon_redeem" ],
    "IF" : [
      { "data_is" : { "data" : [ "coupon:is-active" ], "value" : 1 } },
      { "entity_has_field" : { "entity" : [ "coupon" ], "field" : "field_free_shipping" } },
      { "data_is" : { "data" : [ "coupon:field-free-shipping" ], "value" : "Yes" } }
    ],
    "DO" : [
      { "commerce_shipping_delete_shipping_line_items" : { "commerce_order" : [ "commerce_order" ] } },
      { "commerce_shipping_service_rate_order" : {
          "shipping_service_name" : "free_shipping_service",
          "commerce_order" : [ "commerce_order" ]
        }
      }
    ]
  }
}
Answer by: torq
Posted: Jul 26, 2012