On a Drupal Commerce project of about 2000 products, the client wants to set sale prices for some of the products. The client also wants to set a sale expiration per product so that after a certain date, the product is no longer on sale. Is there a module or technique that could accomplish this easily?


Commerce Sale Price provides per-product sale prices. Someone offered to provide exactly what you want but they haven't actually done so yet. The only thorny thing about achieving this is being able to work with Commerce's precalculated price system (you'll find some links on the Commerce Sale Price project page). At first you'd think this could all be done using Rules, but as I understand it, the system requires that a discount rule either be related to some global condition such as the date (which can get checked when a View is executed) or related to the product itself (such as an on sale field). The problem with your requirements is that the price is related to something external (the date) and something attached to the product. The only way I can see around this is by having a cron run that switches on/off the normal sale price flag based on the schedule fields (and causes the precalculated prices associated with that product to be updated).

For any of the precalculated stuff to work you'll need to follow the instructions on Sale Price's project page (you need to patch Commerce and use a sandbox module).

Addendum: Having said all that, if you don't ever need to use the precalculated price as a field in a View then I think you can do things entirely with Rules.


You can use Rules in combination with price textfield attached to the product entity.

Here are the steps:

  • Add a price textfield to the product entity and call is discount price or something similar.
  • Add a rule that react to the Redeem a coupon event
  • Add conditions: Data comparison commerce-line-item:type value = product, Entity has field: check for the price textfield from step one, check that data value is not empty, add date check for expiration.
  • Under actions add a calculation that add the amount of the field to the unit price(Data/Calculate a value).
  • Uses VBO to assign the discount to products in bulk.

This is a somewhat of a lengthy process but other than writing a custom module, Commerce really does not provide any other solution (at least not one that is documented anywhere...).

  • Have you managed to get anything like this working with Views? – Andy Aug 14 '12 at 7:57
  • Once you set the above, you'll need to set commerce Product: Price field in Views to Display the calculated sell price for the current user. That will display the discounted price in views. – ahimsauzi Aug 21 '12 at 21:33
  • 1
    Thanks, yeah that's fine for displaying... I'm fairly sure you can't filter or sort by the sale price with this method however (basically because what's stored in the database isn't the calculated price). (Would love to be proven wrong though!) – Andy Aug 22 '12 at 10:23
  • If I use this method with the rule,is this possible to have price formatters like:"You save" etc? thanks – sokratis Mar 30 '15 at 12:19
  • sokratis, have a look at Commerce Price Savings Formatter. It will give you a price formatter for views. – ahimsauzi Mar 31 '15 at 14:34

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