Videos

Drupal Commerce Basic Discount

Date Published: 
04/19/2011
Duration: 
06:58

Discounts in Drupal Commerce
Overview

  • Create a discount using a rule
  • Create a weekend (date-based) sale discount using a rule
  • Create a tag-based weekend sale discount using a rule

Simple Discount

An example of a simple discount: You want to take 10% off everything in your store until further notice.

  1. Go to Store -> Configuration -> Product Pricing Rules
  2. Click "Add a pricing rule"
  3. Give your rule a name
  4. Under "Actions" click "Add Action"
  5. Under "Commmerce Line Item" choose "Multiply the Unit Price by Some Amount"
  6. The data selector should be "line_item"
  7. The amount should be .9 (in other words, multiply the price by .9).
  8. Now all products have 10% taken off of them.

Simple Discount using the VAT Hack

The problem with simple product pricing rules is that there's currently no way to actually show why the prices are what they are. We'll eventually have more options here. But right now, you can accomplish what we just did using negative VAT. VAT is, of course, a tax which is included in a product price normally, but there's not much difference between that and a discount... but a discount is a negative tax.

  1. Go to Store -> Configuration -> Taxes -> Tax Types
  2. Create a new tax type of "Discount".
  3. Give it a title
  4. Check "Display taxes of this type inclusive in product prices".
  5. Go to Store -> Configuration -> Taxes -> Tax Rates
  6. Add a tax rate - give it a name and a tax rate of -0.10
  7. Under type, choose the type that you created above.
  8. Visit "Cart" and you'll see that the discount is being taken.
  9. Visit the checkout page and you'll see that the discount is explained and accounted for in the subtotal.