This module helps you set up percentage coupons that only apply to specific products. It uses a multi-value entity reference field attached to the coupon to select which products will be discounted. If the field is left empty then the coupon will be valid for all products.
The module adds:
- A new condition for evaluating whether an order contains a product referenced by a coupon (commerce_couponprodref_order_has_referenced_product);
- A multi-value entity reference field linking coupons to products (field_commerce_couponprodref);
- A Rules component for applying percentage coupons to line items where they match the reference field (rules_commerce_couponprodref_apply_coupon_to_line_item_component);
- A new coupon validation rule that won't allow a coupon to be redeemed if it has a populated reference field that doesn't match any of the products in the cart (rules_commerce_couponprodref_validate_refererenced_products).
The future!
I understand that with Commerce Coupon 2.x and Commerce Discount this module won't be needed any more.
Installation & Use
- Enable the module as normal.
- Clear all caches.
- It's necessary to modify the percentage coupon pricing rule.
- Go to Configuration -> Workflow -> Rules and click edit for the rule Apply percentage coupons to product line item.
- Delete the looped action Apply a percentage coupon to a product line item.
- Add a new looped action rule: Apply coupon to line item (checking product reference).
- Select commerce-line-item for the line item and list-coupon for the coupon. (If you can't find list-coupon then it's possible you didn't try to add an action within the loop - make sure to click Add action under Operations for the loop.)
- The reference field is added automatically to the bundle commerce_coupon_pct (it can be removed). The field can be added to other coupon types if desired.
You should now be able to create new percentage coupons that reference products. If a customer tries to use a coupon that doesn't match any products in their cart, then there will be a validation failure. If a customer does have one or more valid products for that coupon, then all referenced products will be discounted appropriately.
Downloads
Recommended releases
Development releases
Project Information
- Maintenance status: Actively maintained
- Development status: Under active development
- Module categories: E-commerce, Features Package
- Reported installs: 258 sites currently report using this module. View usage statistics.
- Downloads: 806
- Automated tests: Enabled
- Last modified: May 19, 2013