Magento Shopping Cart Price Rules and Promotions Tutorial
How to set up and manage shopping cart price rules in Magento
In Magento you can set up different promotions and discounts that apply only to the products in the customer's shopping cart. The shopping cart price rules can be based on different combinations of conditions. The conditions themselves can be based on various attributes of the products in the cart (category, SKU, manufacturer, etc.) and/or on the different shopping cart attributes such as shipping country, shipping state/province, total weight, etc.
Magento also has options for configuring catalog price rules which are applied to the products in the catalog not just to those in the cart. For more information on this check out the tutorial on setting up and managing catalog price rules in Magento. In this tutorial we'll concentrate on shopping cart price rules.
To add and edit shopping cart price rules in the admin panel of your Magento go to Promotions menu>Shopping Cart Price Rules. On the page that opens there's a table with the existing shopping cart price rules. To edit a rule click on its row in the table. By default, Magento (both with and without sample data) comes with no example shopping cart price rules preconfigured. To add a new rule click on the Add New Rule button that's above the top right corner of the table:
On the add/edit page there are a few buttons on the left which are used to group the price rule settings into sections. Clicking on each one will display different settings on the right:
These sections include:
The necessary settings that you have to configure are in the sections Rule Information, Conditions and Actions.
If you add a rule for a specific discount coupon, another section will be added. It's called Manage Coupon Codes and you'll need it in case you want to generate coupon codes automatically. We'll come to this further down in the tutorial.
Shopping Cart Price Rule Information
When you add or edit a shopping cart price rule the settings in the Rule Information section are displayed by default:
Let's go over the settings:
- Rule Name - type some name for the price rule. It's for internal use. You can manage the labels for the price rule as you want them to appear on the frontend from the Labels section.
- Description - this is an optional field. You can use it to type some information that's related to the price rule (e.g. details that will remind something about the price rule). This description is not shown on the frontend.
- Status - from this option you can select whether the price rule should be active or not.
- Websites - this is a list of the websites that you have created from System>Manage Stores. Mark the website(s) on which you want the shopping cart price rule to apply. To mark/unmark more than one website press and hold the Ctrl button on you keyboard and click on the name with the left mouse button.
- Customer Groups - from this list you can select the customer group or groups for which you want the price rule to be valid. The price rule will apply to all customer who belong to the selected customer groups. As with the option about websites you can mark/unmark more than one group with the help of the Ctrl button on your keyboard.
- Coupon - by default, this option is set to No Coupon which means that no coupon code is required and the price rule will apply to any customer belonging to one of the selected groups in the Customer Groups option. If you select Specific Coupon, a couple of new options will be added just underneath this one:
This first option is labeled Coupon Code and, as the name suggests, it's for specifying a coupon code. You can type a code manually, or you can let Magento generate it automatically. In case you want to generate code(s) automatically mark the checkbox for Use Auto Generation. When you do that and you save the rule a new section will appear on the left side of the add/edit rule form. It's called Manage Coupon Codes (in fact this section will be added after you save the rule even if you leave the Coupon drop-down menu to No Coupon); you can use it to specify the rules for generating the codes and to generate one or more coupon codes. In order for a customer(s) to be able to use the promotion that's created with the price rule you need to provide that customer or customers with the coupon code(s).
The second option is Uses per Coupon. If you leave the field blank or you put 0, the coupon can be used countless number of times as long as the price rule is active. If you want customers to be able to apply the coupon a limited number of times, just type the number in the field. Note that the number of times a coupon can be used is applied to all customers regardless of what you put in the field for Uses per Customer (described below). For example, if the coupon can be used one time and a customer applies and uses that coupon, then the coupon can't be used by another customer.
Coupons can be applied on the cart page on the frontend. There's a special block that's intended for that purpose:
The customer only has to type the code in the field that's provided and click on the Apply Coupon button. The discount will be automatically shown in the block on the right that displays the grand total, taxes, shipping charges, etc. At this point the coupon can be canceled. It's counted as a used coupon after the order is placed.
Now let's go back to the Rule Information settings of shopping cart price rules:
- Uses per Customer - you can use this option to specify how many times the particular promotion can be used by a customer. If you leave the field blank or you put 0, there will be no limit. If, for example, you put 2, the promotion can be used by each customer (provided they belong to a customer group for which the price rule is valid) two times.
- From Date and To Date - you can use these two options to specify a period of time for which the promotion will be valid. Just click on the small calendar button next to each field and select the data from the calender that pops out. If you leave them blank, the price rule will be applied immediately and for an indefinite period of time (as long as its Status option is set to Active).
- Priority - since you can add more than one shopping cart price rule in some cases more than one price rule can meet the conditions and be applied to the products in the customer's shopping cart. With this option you can configure the order in which price rules should be applied. Those with a lower number for priority are applied before those with a higher one. For example, a price rule with 0 for priority is applied before another one that has 1 for priority.
- Public in RSS Feed - by default, this option is enabled. To disable it set it to No.
When you're done with these settings if you want to, click on the Save and Continue Edit button before you configure the options in the other price rule sections.
Shopping Cart Price Rule Conditions
Click on the Conditions button on the left to configure the conditions which have to be fulfilled in order for the shopping cart price rule to be applied:
The principle of adding and configuring conditions is exactly the same as with catalog price rules. So for more information on how to do this check out the Conditions section of the Magento tutorial on managing catalog price rules. The difference is that with shopping cart price rules you can add as conditions not only categories, product attributes and attribute sets, but also cart attributes such as the subtotal of the cart, the total weight of the products, the payment method, the shipping method, the shipping country, the shipping state, province, etc. Thus using all the available conditions you can create hundreds of combinations depending on what exactly you want to do.
Shopping Cart Price Rule Actions
Click on the Actions button on the left to configure the shopping cart price rule action settings. Some of the settings are the same as those for catalog price rules but there are some differences:
The settings that you can configure in this section are:
- Apply - from this option you can select how the discount is to be calculated. By default, Percent of product price discount is selected; with this option the discount is calculated as a percentage of the original price which is then subtracted from that price to form the final price. For example, if you put 10 in the field for Discount Amount and the product in the cart is $80, then the final price will be $72 ($80 original price - $8 (10 % of 80) = $72).
If you select Fixed amount discount, the discount that you put in the field for Discount Amount is a fixed sum that's subtracted from the price of the product. For example, if the discount is 10 and the product costs $80, then the final price will be $70.
If you select Fixed amount discount for whole cart, the discount is a fixed sum that subtracted from the subtotal of the cart. This is what makes it different from Fixed amount discount with which the discount sum is subtracted from each item in the cart and not from the subtotal price of all the items. For example, you have set the discount to be 10 and there are two items in the cart each of which costs $80 (subtotal is $160). If the Fixed amount discount for whole cart option is applied, the total discount will be $10 which makes the final price $150. If the Fixed amount discount option is selected, in the same situation the final price will be $140 because the $10 discount is subtracted from the price of each item and not from their combined price.
If you select Buy X get Y free (discount amount is Y), when the customer orders a particular number of items from one product they get one or more items of the product for free. In the field for Discount Amount that's on the same page you need to put the number of items that the customer gets for free, and in the field for Discount Qty Step (Buy X) you need to put the number of items that have to be ordered so that the customer receives the number of items specified in the Discount Amount field for free.
So, for example, if you put 3 in the field for Discount Qty Step (Buy X) and you put 1 in the field for Discount Amount, when the customer puts 4 items of a product in the cart one of them will be free (its price will be subtracted from the subtotal). By default, the promotion will be applied to any product that's put in the cart. If you want it to apply, for example, only to a particular product, you can set the SKU of that product as a condition using the settings that are on the same page:
The principle of adding conditions is the same as with the general conditions that are set from the Conditions section. If you set any conditions from the Actions section, they will apply not only with Buy X get Y free (discount amount is Y) but with whatever you select from the Apply drop-down menu.
Let's continue with the rest of the shopping cart price rule action settings:
- Discount Amount - specify the discount amount in this field. It will be calculated as a percentage, as a fixed amount or as a whole item(s) depending on what you chose from the Apply option that we described above.
- Maximum Qty Discount is Applied To - if you leave this option blank or you put 0, this means that there are no restriction on the number of items in the cart to which the discount is applied. If you want the discount to be applied to a limited number of items in the cart, put that number in the field. Note that what's taken into account is not the total number of items in the cart but the number of items from each product. So, for example, if you set this option to 5 and a customer puts six products in the cart and there are five or fewer than five units from each product in the cart, then the discount will be applied to all products (provided all products meet the conditions of the rule). If the customer puts more than five units from the same product, then the discount for that product will be applied only to five of the units.
- Discount Qty Step (Buy X) - as we already mentioned, if you select Buy X get Y free (discount amount is Y) from the Apply drop-down menu on the same page, then you can use this option to specify the number of units from a product that the customer has to order so that they can get a certain number of items for free (the number of free items is specified in the Discount Amount field). As the name of the option suggests this is a step, so if you put 3 for this setting and 1 in the field for Discount Amount and a customer puts 4 items in the cart, then 1 will be free. If the customer puts 8 items of a product in the cart, 2 will be free.
This option also works with the other methods that can be selected from the Apply menu. For example, if you set it to Percent of product price discount, you put 10 in the field for Discount Amount and 3 in the field for Discount Qty Step (Buy X), and a customer puts 3 units of a product in the cart, then each of these units will be 10 % cheaper. If the customer puts 2 units of a product, then there will be no discount for those items.
- Apply to Shipping Amount - by default, the discount is not applied to shipping charges. If you want the shipping amount also to be discounted, set this option to Yes.
- Free Shipping - by default, this is set to No. If you set it to For matching items only, no shipping charges will be calculated for the items in the cart to which the shipping cart price rule applies. If you select For shipment with matching items and there are items in the cart for which the price rule is valid, then there will be no shipping charges for the whole shipment.
- Stop Further Rules Processing - by default, this is set to No which means that if there are other price rules that are valid for particular items in the cart, then they will be applied too. If you don't want any other rules to be applied after this rule is applied, set this option to Yes. Of course, this includes rules that have a lower priority than the price rule that you're adding/editing (the priority is set from the respective option in the Rule Information section).
After you're done with the settings in the three sections that we described above make sure you save them by clicking on the Save or on the Save and Continue Edit button.
There are a couple of other sections with optional settings that you don't need to edit. These are the sections Labels and Manage Coupon Codes.
Shopping Cart Price Rule Labels
If you want to specify a name for your discount as you want it to be seen on the frontend by customers, click on the Labels button on the left:
On the page that opens there's a field in which you can type the label as it will appear in all store views if there's no label specified for the particular store view. If you want the label to be different per store view, then you can type it in the corresponding field that's provided for the store view.
If there's no label specified, the discount will be labeled on the cart page on the frontend as just Discount. If there's a label specified, it will be displayed in brackets after Discount. For example, if the label for a store view is 10 % off promotion, then on the frontend the discount will be listed in the cart as Discount (10 % off promotion).
Manage Coupon Codes
This section will be accessible once you save the shopping cart price rule. You can use the settings in this section if you set the Coupon option in the Rule Information section to Specific Coupon and you mark the checkbox for Use Auto Generation. As we discussed in the Rule Information section of this tutorial, when you create a price rule as a specific coupon you can either set the code manually or use the automatic generator. In case you want to generate codes automatically you have to do it using the settings in the Manage Coupon Codes section:
You can generate many coupon codes at the same time; specify the quantity in the field for Coupon Qty. You can set the length of the codes in the field for Code Length, and from the Code Format drop-down menu you can select whether the codes should include letters and numbers, only letters, or only numbers. If you want the generated codes to have a fixed prefix and/or suffix, type them respectively in the fields for Code Prefix and Code Suffix.
By default, no dashes are put between the characters in the code. If you want a certain number of characters in the code to be separated with a dash, put that number in the field for Dash Every X Characters. For example, if you put 2, the code characters will be put into groups of two and there will be a dash between each group (e.g. e3-wd-7u-tp). Note that dashes are not put in the prefix and the suffix (if any), between the prefix and the first character of the code and the last character and the suffix (e.g. prefixe3-wd-7u-tpsuffix). The dashes are not counted as part of the code length, but if there's a prefix and/or a suffix and dashes, the customer has to type the whole thing so that the coupon is accepted as valid.
After you configure the settings click on the Generate button to create the coupons. They will be listed in the table under the options. You can delete coupons by marking their checkbox in the table and using the Actions button in the upper right corner of the table. Although the letters in the generated codes are capitalized, coupon codes are case insensitive so it doesn't matter whether the customer uses upper or lower case letters. After you're done with the coupon codes don't forge to click on the Save or on the Save and Continue Edit button.
Each time you add a new rule the options for code length, format, prefix, suffix and dashes will be set to their default values. To change those default values go to System menu>Configuration>Promotions button in the Customers section on the left>Auto Generate Specific Coupon Codes panel on the right: