On my commerce site, I want to add a coupon which can be use for a particular brand or catagory (taxonomy : product attributes).I am using commerce module with drupal 7. Any one help me on rule making...


Sure, no problem. Just create a new rule that triggers on the event "Calculating the sell price of a product."

You want the condition: Entity has field, then choose the commerce_product. This is the product reference field that is inherent in line items. Then, choose the condition: Entity has field again. Choose the brand entity reference field that you have built into your product type. Basically, you will be reaching through the line item, through the product the line item refers to, to hit the brand that product is tagged with. Next, choose the condition: Data comparison. For Data to Compare, choose that brand reference field. For Data value, switch from data selection to direct input mode, then choose the brand you wish to target.

Finally, under actions, add one of the commerce line item actions based on the mathematical operation you wish to do with that brand price.

This should do it!

  • Thanks Steve for your kind help It was really helpful to me but I have one issue there .Actually I want to use coupon for a particular category and category field is a custom field of products. And I am not able to get custom field of product in Data Selector .So can you tell me how I can get custom fields in rule's Data Selector.....Thanks once again – Bittu Sharma Aug 28 '12 at 10:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.