{"id":2560,"date":"2024-12-31T20:23:00","date_gmt":"2024-12-31T20:23:00","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/how-to-create-coupon-code-in-magento-2-complete-guide\/"},"modified":"2025-06-16T13:11:09","modified_gmt":"2025-06-16T07:41:09","slug":"create-coupon-code-in-magento-2","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/create-coupon-code-in-magento-2\/","title":{"rendered":"How to Create Coupon Code in Magento 2? &#8211; Complete Guide"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Offering discount codes is a proven technique to convert more visitors into customers. In Magento 2, you can create coupon codes in a few easy steps and get your campaigns running.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this guide, you\u2019ll learn how to create coupon code in Magento 2 and examples.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-to-create\">How to Create a Coupon Code in Magento 2?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Magento 2 has a concept of \u201cCart price rules\u201d that define the rules (conditions) for discounts. In the cart price rule, you can create a specific coupon code required to avail the discount. You can also auto-generate coupon codes in Magento 2 for the cart price rule.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"create-specific\">Method 1: Create a Specific Coupon Code<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To create a Magento 2 discount code, navigate to&nbsp;<strong>Marketing &gt; Promotions &gt; Cart Price Rules<\/strong>&nbsp;in your admin.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2024\/04\/1-cart-price-rule-in-magento-2.png\" alt=\"Magento 2 admin with selected Cart Price Rules in Marketing section\" class=\"wp-image-50467\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">In the&nbsp;<strong>Cart Price Rules<\/strong>&nbsp;grid, click the \u201c<strong>Add New Rule<\/strong>\u201d button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2024\/04\/2-add-a-new-cart-price-rule-in-magento-2-700x315-1.png\" alt=\"Cart Price Rules\u00a0grid\" class=\"wp-image-50469\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Enter a name and description for the cart price rule and select the applicable websites and customer groups.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To specify a coupon code for the discount, set&nbsp;<strong>Coupon<\/strong>&nbsp;to \u201c<strong>Specific Coupon<\/strong>\u201d and define your coupon code.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2024\/04\/3-create-a-coupon-code-in-cart-price-rule-in-magento-2-700x416-1.png\" alt=\"Magento 2 configuration for New Cart Price Rule\" class=\"wp-image-50471\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Optionally, you can also specify certain conditions and rules for the discount from the&nbsp;<strong>Conditions<\/strong>&nbsp;section.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can set limits on the number of uses per coupon code or customer. And also define a specific date range for the validity of the coupon code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It\u2019s helpful to set a Magento 2 coupon expiration date for time-sensitive discounts.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2024\/04\/4-coupon-code-settings-magento-2-700x328-1.png\" alt=\"Magento 2 coupon expiration date selection\" class=\"wp-image-50472\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Next, expand the&nbsp;<strong>Actions<\/strong>&nbsp;section to define the discount. In this example, we\u2019re setting a 75% discount on the cart. You can also set a fixed amount or buy X get Y discount.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2024\/04\/5-define-discount-amount-in-cart-price-rule-700x257-1.png\" alt=\"Actions\u00a0section in the cart price rule\" class=\"wp-image-50474\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Click the \u201c<strong>Save<\/strong>\u201d button to save the cart price rule with discount code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That\u2019s how straightforward it is to create a specific discount code in Magento 2.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"auto-generate\">Method 2: Auto-generate Coupon Codes in Bulk<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In Magento 2 cart price rules, you can use the auto-generation feature to create coupon codes in bulk.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To do that, check the \u201c<strong>Use Auto Generation<\/strong>\u201d option against the Coupon Code field.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2024\/04\/6-auto-generate-magento-2-coupon-codes-700x202-1.png\" alt=\"Coupon Code field configuration\" class=\"wp-image-50475\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Now, configure the&nbsp;<strong>Conditions<\/strong>&nbsp;and&nbsp;<strong>Actions<\/strong>&nbsp;for the discount rule as per your needs and click \u201c<strong>Save and Continue Edit<\/strong>\u201d on the top right to save the rule. (This is important since you will not be able to generate the coupon codes without saving the rule)<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2024\/04\/7-save-and-continue-edit-700x492-1.png\" alt=\"Coupon codes rule saving\" class=\"wp-image-50476\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Scroll down to the&nbsp;<strong>Manage Coupon Codes<\/strong>&nbsp;section and configure the coupon code settings. Enter the quantity and length of the coupon codes you want to generate and select the format.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Click the \u201c<strong>Generate<\/strong>\u201d button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2024\/04\/8-define-coupon-code-settings-magento2-700x405-1.png\" alt=\"Manage Coupon Codes\u00a0section\" class=\"wp-image-50479\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Once generated, you can find the list of coupon codes in a grid under the same section.<br><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2024\/04\/9-list-of-magento-2-auto-generated-coupon-codes-700x349-1.png\" alt=\"list of coupon codes in a grid\" class=\"wp-image-50480\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">That\u2019s how you can have <a href=\"https:\/\/meetanshi.com\/blog\/add-coupon-code-column-in-magento-2-order-grid\/\" data-type=\"link\" data-id=\"https:\/\/meetanshi.com\/blog\/add-coupon-code-column-in-magento-2-order-grid\/\">Magento 2 auto-generated coupon codes<\/a>. You can start distributing these discount codes to your customers and promote the sales.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can test the created&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/best-coupon-code-extensions-for-magento-2\/\">Magento 2 coupon code<\/a>&nbsp;on the shopping cart page in the front end.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2024\/04\/10-test-magento-2-coupon-code-700x365-1.png\" alt=\"shopping cart page in the front end\" class=\"wp-image-50481\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Ta-da!   You\u2019ve successfully created and applied a discount code in your Magento 2 store.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"examples\">Examples of Magento 2 Coupon Codes<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Magento 2 discount codes are helpful for promoting sales, and they\u2019re more effective when used strategically. Here are some popular examples of how to create and use Magento 2 discount codes more effectively.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"product-specific\">Product-specific Coupon Code<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In Magento 2 cart price rules, you can set up conditions to offer discounts only on certain products. This can be useful while running seasonal sales.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s say you want to create a discount code for a specific product in your Magento 2 store. You can do this by matching its SKU in the conditions section. Create a new cart price rule with the coupon code for the discount offer and add the conditions to match the product by its SKU, as shown below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2024\/04\/11-product-specific-magento-2-coupon-code-700x280-1.png\" alt=\"Set rule by applying condition for Product-specific Coupon Code \" class=\"wp-image-50483\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">You can define multiple rules and logic in the conditions section to create Magento 2 discount codes using product attributes like SKU, category, brand, etc.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"customer-group-specific\">Customer Group-specific Coupon Code<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">You can change the scope of the cart price rules to create discount codes for specific customers in Magento 2. To do that, you\u2019ll need a customer group to which you want to offer the discount.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Simply follow the above steps to create a discount code in Magento 2 using the cart price rules and select the customer group to which you want to offer it.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2024\/04\/12-customer-specific-discount-code-in-magento2.png\" alt=\"Select customer group to apply Coupon code\" class=\"wp-image-50484\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><br>This way, you can create exclusive discount codes for your loyal customers in Magento 2.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><div class=\"meetanshi-cta\">\r\n<div class=\"cta-content-wrapper\">\r\n<span>Magento 2 Coupon Code Link<\/span>\r\n<p>Convert coupon codes to links that apply discounts directly at the checkout page.<\/p>\r\n<a href=\"https:\/\/meetanshi.com\/magento-2-coupon-code-link.html\" target=\"_blank\" class=\"btn-primary\">Covert Now<\/a>\r\n<\/div>\r\n<div class=\"cta-image-new\">\r\n<img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2025\/11\/coupon-code-link.png\" alt=\"Magento 2 Coupon Code Link\">\r\n<\/div>\r\n<\/div><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"promote-using-links\">Bonus: How to Promote Magento 2 Discount Codes Using Links?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Take the customer experience of your store to the next level (literally) with coupon code links. Our&nbsp;<a href=\"https:\/\/meetanshi.com\/magento-2-coupon-code-link.html\">Magento 2 Coupon Code Link<\/a>&nbsp;extension converts your normal coupon codes into links that customers can use to grab deals.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Using the extension, you can:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Convert existing coupon codes into links<\/li>\n\n\n\n<li>Redirect links to specific pages in your store<\/li>\n\n\n\n<li>Auto-apply discount code on the cart page<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Make it easier for the customers to grab deals and discounts in your store. Create links for discount codes and share anywhere. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Offering discount codes is a proven technique to convert more visitors into customers. In Magento 2, you can create coupon codes in a few easy&#8230;<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-2560","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2560","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=2560"}],"version-history":[{"count":3,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2560\/revisions"}],"predecessor-version":[{"id":16884,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2560\/revisions\/16884"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=2560"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=2560"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=2560"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}