Configure coupon codes

The length and format of automatically generated coupon codes is controlled by the configuration. The characters can be set to all numbers, all letters, or a combination. You can insert a dash at set intervals to make it easy to read, and add a prefix and suffix to associate the code with a specific campaign or initiative.

  1. On the Admin sidebar, go to Stores > Settings > Configuration.

  2. In the left panel, expand Customers and choose Promotions.

    Customers configuration - auto-generated specific coupon codes

  3. Expand the Auto Generated Specific Coupon Codes section.

    Customers configuration - auto-generated specific coupon codes

  4. Enter the Code Length, including prefix, suffix, and separators.

  5. Set the Code Format to one of the following:

    • Alphanumeric
    • Alphabetical
    • Numeric
  6. For Code Prefix, enter the value that you want to appear at the beginning of all coupon codes.

  7. For Code Suffix, enter the value that you want to appear at the end of all coupon codes.

  8. For Dash Every X Characters, enter the number of characters between each dash.

    Coupon codes with different dash patterns are considered to be different codes, even if the numbers are the same.

  9. When complete, click  Save Config.

Create coupons

NOTE
Before you create coupons, use the bin/magento cron:run command to verify that cron is running. See Run cron from the command line in the Configuration Guide for more information.

Method 1: Create a specific coupon

  1. Follow the instructions to create a cart price rule.

  2. In the Rule Information section, set Coupon to Specific Coupon.

  3. Enter a Coupon Code to be used with the promotion.

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

  4. To limit the number of times the coupon can be used, do the following:

    • Enter the number of Uses per Coupon.
    • Enter the number of Uses per Customer.

    For unlimited use, leave these fields blank.

    Cart price rule - coupon information

    NOTE
    If there is simultaneous use of the same coupon by multiple customers at the same time, it is possible that the usage limit that is set could be exceeded due to delayed coupon processing.
  5. To make the coupon valid for a time period, do the following:

    • Magento Open Source (Magento Open Source only) Complete the From and To dates. To select the date, click the Calendar ( Calendar icon ) icon next to each field. If you leave the date range empty, the rule does not expire.

    • Adobe Commerce (Adobe Commerce only) Do one of the following:

      Option 1: Schedule a new update

      • Click Schedule New Update in the upper-right corner of the page.

        Schedule Update

      • Enter the Update Name and Description.

      • Choose the Start Date and End Date from the Calendar (  Calendar icon  ). If you leave the date range empty, the rule does not expire.

      • When complete, click Save.

        Cart price rule - scheduled change

      Option 2: Assign to an existing update:

      • Select Assign to Another Update.

      • Find the update in the list, and click Select.

  6. Complete the cart price rule as needed.