Magento Tutorials

How to Add Coupon Code to Checkout in Magento

You’re thinking of ways to boost your sales and the idea of giving away discount coupons surely pops up in your mind. It’s a very effective strategy to attract new customers and gradually turn them into loyal ones, but setting up Coupon in your online store can be complicated and challenging to figure out.

Therefore, in this tutorial, I’ll guide you through every step of How to set up Coupon in Magento 2 and hopefully help you to increase your sales!

setup coupon in magento

Here is how Coupon works: the discount will be automatically applied to customers when they have all the conditions met (such as submitting a coupon code or their cart reaches a certain amount…).

Create a specific coupon

The first step to get started is Add a Rule in your Shopping Cart Price Rules to let Magento know when to apply coupons code.

Step 1: Add a New Rule

On the Admin panel, go to Marketing > Promotions > Shopping Cart Price Rules > Add New Rule.

cart price rule

Source: docs.magento.com

Then fill out all the boxes required (Rule Name, Description…) and set Status to Active if you want to apply the rule immediately.

Step 2: Associate a Coupon code with the price rule

Set Coupon to Specific Coupon.

Enter a numeric Coupon Code (that’s the code which customers will have to enter to receive the discount).

The format of the code as numeric, alphanumeric or alphabetical is determined by the configuration.

cart price rule coupon

*Customize your coupon:

  • You can set a limit on the number of times a coupon can be used by setting the numbers for Uses per Coupon and Uses per Customer. For unlimited use, leave these fields blank.
  • You can also define the Period of Coupon Code by choosing the first and last date in the Calendar field. If you leave the date range empty, the rule does not expire.
coupon schedule

Step 3: Define the Conditions

In the panel, look for Conditions > Add (From there, choose one of the options that best describes the condition that you want to set for the New rule).

In the Product Attribute list, select the attribute that the condition is based upon. As you finish, the condition will appear in the statement, for example:

If ALL of these conditions are TRUE:
If an item is FOUND in the cart with ALL of these conditions true
Attribute Set is

Click Add and select an option for the condition, such as cart attribute, product subselection, or combination.

product subselection

Then select the category that you want to use as a condition for the price rule.

cart price rule category

Customize the statement to yield your expected result.

Step 4: Define the Actions

This step is to let Magento know what to do once the Coupon code is successfully applied.

In the Admin panel, select Actions.

Set Apply to one of the following discount options:

  • Percent of product price discount: Discounts item by subtracting a percentage from the original price.
  • Fixed amount discount: Discounts item by subtracting a fixed amount from the original price of each qualifying item in the cart.
  • Fixed amount discount for the whole cart: Discounts the entire cart by subtracting a fixed amount from the cart total.
  • Buy X get Y free: Defines a quantity that the customer must purchase to receive a quantity for free.

Define as many additional conditions as needed for the action.

cart price rule actions

Complete the Labels to identity the discount.

cart price rule labels

When complete, click Save Rule.

Price rules are automatically processed with other system rules each night. When you create a new price rule, allow enough time for it to get into the system. Then test the rule to make sure that it works correctly.

*Additional information for Actions:

  • Free shipping (You can either choose among):

No (free shipping not included in Coupon) 

For matching items only (free shipping for specific items)

For shipment with matching items (free shipping available when the coupon is applied)

  • Stop Further Rules Processing (Set to Yes to stop processing other rules once this rule is applied)

When you’ve done, Save Rule to save all your work.

It might take more than one hour for the coupon to get in the system and become available for customers. Remember to test the Rule to make sure that your Coupons will work fine.

Publish a mass of coupons

Step 1: Set a cart price rule

On the Admin panel, go to Marketing> Promotions > Cart Price Rules > Add New Rule.

Fill in the required fields for the new rule.

Step 2: Auto Generation

Under Coupon Code, select the Use Auto Generation checkbox.

To limit the number of times each customer can use the coupon, enter the number of Uses per Customer.

cart price rule auto generation

Step 3: Manage Coupon Codes

Under Cart Price Rule, choose the Manage Coupon Codes tab and do the following:

manage cart price rule
  • For Coupons Qty, enter the number of coupons that you want to generate.
  • Enter the Code Length, not including the prefix, suffix, or separators.
  • Set the Code Format to one of the following: Alphanumeric; Alphabetical; Numeric

Step 4: Generate codes

When complete, click Generate.

The list of generated codes will appear as below:

generated copuons

See also:
How to Customize the Checkout Process in Magento 2
How to Add a Custom Payment to Magento 2 Checkout

Is it helpful?

A knowledge craver who always strive to be wiser everyday.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments