beehexa integrationsidebar
beehexa beehexa logo 1

We Build HexaSync Integration Platform for Connecting ERP, POS, CRM, Accounting, and eCommerce Applications to Automate Business Processes

How To Create Coupon Code in Magento 2

From Magento 2 Coupon codes settings, depending on the conditions you set, the Free Shipping can be applied for any order when all conditions are met. At the same time, you can generate multiple codes to offer or just one single code with limited use. With coupon codes, you can provide free shipping in a more extensive way instead of just being able to set minimum order values like other shipping methods. Also, customers can choose to apply coupons or save for further uses.

Step 1: Disable Free Shipping in Store Configuration

In order for Cart Price Rules to work, you should disable free shipping in Stores > Configuration > Sales > Shipping Methods. Because enabling free shipping for all stores will override your promotion or coupon code.

stores configuration view

Step 2: Create new Cart Price Rules

Coupon code in Magento can be set through a cart price rule. After verifying that the free shipping method is disabled, go to Promotions, under Marketing choose Cart Price Rules > Add New Rule

While creating a new rule, you are required to fill all Rules related fields.

  • Rule Name: Enter name for your rule. You can set any Name to your rule. It is for internal use only.
  • Status: Set Active to apply the rule
  • Websites: Select Websites to where you want to apply the rule
  • Customer Group: Select entire Customer Group or those groups you want to apply
  • Coupon: If you want to add coupon then select specified coupon from drop-down
  • Uses per Coupon: It specifies the number, that how many times customers can use per coupon
  • From Date, To Date: It is the time validation of setting rule
  • Priority: Set value 0 or 1 for priority. The lowest priority rule will apply first.
  • Public in RSS Feed: Set yes if you want to distribute your information online
set cart price rules name

Magento 2 coupon code is a powerful fuction that allow you to either set one coupon to offer free shipping or generate a batch of coupons with various choices.

Method 1: Create A specific Coupon

On the General Information page, set Coupon to Specific Coupon from drop-down

Enter a Coupon Code to be used with the promotion

  • The format of the code is numeric, alphanumeric or alphabetical depend on you

To limit the number of times the coupon can be used, choose:

  • Use per Coupon: Limit the use of coupons regardless of the number of uses per customer
  • Use per Customer: Limit the use of coupons per customer

If you leave these fields blank, it will become unlimited use.

select specific coupon from drop-down

Method 2: Create A List of Coupons

Under Coupon Code, tick the Use Auto Generation checkbox

tick auto generation checkbox

To limit the number of times the coupon can be used, choose:

  • Use per Coupon: Limit the use of coupons regardless of the number of uses per customer
  • Use per Customer: Limit the use of coupons per customer

Then, scroll down and expand Manage Coupon Codes section.

  • Coupons Qty: the number of coupons you want to generate
  • Code format:
    • Length: length of code not including the prefix, suffix, or separators
    • Format: can be either alphanumeric, alphabetical or numeric
    • Prefix: (optional) add to the beginning of code
    • Suffix: (optional) add to the end of code
    • Dash Every X Characters: add character between each dash (xxx-xxx)

Besides, you can apply Code Prefix and Suffix in a specific campaign or initiative.

When complete, choose Generate. It will take a few minutes to generate depends on the number of codes

Coupon code manange section

Step 3: Complete Cart Price Rule and test the rule

Next, expand the Actions section, and select yes for Apply to Shipping Amount.

Set Free Shipping condition to For matching items only.

apply coupon in store views

Later, expand the Label section and enter a default label name that will be seen in stores by customers.

add coupon label name

When complete, choose Save.

Finally, apply coupon on Store views to check whether the coupon is working or not.

Apply coupon on store views

Create Magento Discount Coupon

For discount coupon only, you can follow these steps:

Expand the Action section and set Apply to Percent of Product Price Discount.

set discount percent

Then set the Discount Amount in number. By default, the discount can be applied to all of your products.

To limit the products that receive the discount, expand the Conditions section below and choose Product Attribute combination by clicking green plus symbol.

select product to apply discount coupon

Then Select SKU from Product Attribute, choose the products from the table.

Moreover, we cover how it all works in the video below.

For more information, please refer to Magento 2 User Guide. Learn how to set up free shipping for specific products here.

Table of Contents

Ready to integrate and automate at scale ?

Learn how HexaSync lets you build enterprise-grade integrations and automations without having to code.

Receive Exclusive Productivity Tips Directly in Your Inbox

We’ll email you 1-3 times per week—and never share your information.

Get started for free

You can’t add more hours to the day. Beehexa is the next best thing.