Creating Coupons in Bulk

Overview

You may need to create a large number of unique discount codes with the same settings.

Solution

You can create up to 3000 coupons at a time from Symphony Manage:

  1. Navigate to Discounts > Coupons.
  2. Click New in the top right corner of the page.
  3. Select the Bulk Create option.
  4. Configure the coupon settings as described in the Creating Coupons Manually article. 
  5. Enter the coupon Quantity (up to 3000).
    Note: If you enter a higher value, the request may time out.
  6. Click Generate And Download.
    A CSV file with the generated coupons is downloaded within a few minutes.

    mceclip0.png

If you need to create a larger number of unique coupons, submit a request to Symphony Support providing the following information:

  • Number of coupons to be created
  • Settings for the coupons:
    • Amount of the discount
    • Items or categories to which the discount will apply
    • The start and expiration date for the coupons
      Note: Alternatively, you can send us a sample code that is already created with the required settings - we will use it to recreate coupons in bulk.

<supportagent>

  1. Create a sample coupon manually with the required settings (if a sample code was not provided by the brand).
  2. From the Discounts > Coupons page in Manage, open Developer Tools by pressing F12.
  3. Search for the sample code.
  4. Select the coupon?column line from the Network tab in developer tools.
  5. Copy the Response starting from {"createdAt".

    mceclip0.png

  6. From the response that you copied, remove the following sections:
    • createdAt
    • id
    • code
    • issuer
    • highlights

      mceclip1.png

      After modification, it should have sections similar to the below code:
      {"updatedAt":null,"importSource":null,"importRef":null,"subdomain":"kittyprod","type":"PERCENT","targetType":"LINE_ITEM","amount":30,"targetId":null,"expirationForSearch":"12/31/21","expiration":1609487940000,"createdForSearch":"01/20/21","active":1579832820000,"created":1611135737426,"minPrice":4000,"maxPrice":null,"maxUses":1,"numUses":0,"maxUsesPerUser":1,"maxUsesPerCart":null,"maxUsesPerCartPref":null,"issuer":"","reason":"","disabled":false,"taxCode":null,"ruleSetId":5172862,"rules":{"rules":[{"rules":[],"operator":"CONTAINS","junction":null,"field":"lineItem.product.categories.id","value":"12430","valueFunction":null,"context":null},{"rules":[],"operator":"EQ","junction":"AND","field":"lineItem.type","value":"\"SIMPLE\"","valueFunction":null,"context":null},{"rules":[],"operator":"EQ","junction":"OR","field":"lineItem.type","value":"\"SUBSCRIPTION\"","valueFunction":null,"context":null},{"rules":[],"operator":"EQ","junction":"OR","field":"lineItem.type","value":"\"KIT\"","valueFunction":null,"context":null}],"operator":null,"junction":null,"field":null,"value":null,"valueFunction":null,"context":null}}
  7. Open Postman and copy the updated response into the Body tab.
  8. Enter your Symphony Manage credentials under the Authorization tab.
  9. Copy the following POST API call for the corresponding brand into Postman.
    https://manage.symphonycommerce.com/org/<BRAND>/api/v1/coupon/bulk-create?quantity=1000

    • Change the quantity to 1 and click Send to check if a code is created successfully; if a test API call returns 400 Bad Request error, you may have removed additional comma or quotation mark and broke the syntax.
      Then, change the quantity back to 1000.
      Note: It is not recommended to create more than 1000 codes per call.
  10. Click Save > Save As and save this call as a new collection.

    mceclip2.png
  11. Click on the Runner button in the top left corner of the app.

    mceclip5.png

  12. Select the newly created collection
  13. Enter the required number of iterations with a delay of 100ms for each call.
    If you need to create more than 100,000 coupons, run a batch of 100 iterations, and once it is complete run another batch of up to 100 iterations.
  14. Click Run.

    mceclip4.png

    A 200 OK message will be displayed after successful execution.
  15. Connect to the database and export the codes that you have created.
    SELECT code FROM CouponCode WHERE site = '<brand>' 
    AND disabled = 0 ORDER BY id DESC LIMIT <Number of coupons created>;
  16. Save the query results as a CSV file and send it to the requester.

</supportagent> 

Testing

You can create a test order on your website to check if the newly created coupons provide the configured discount.

Comments

0 comments

Article is closed for comments.