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:
- Navigate to Discounts > Coupons.
- Click New in the top right corner of the page.
- Select the Bulk Create option.
- Configure the coupon settings as described in the Creating Coupons Manually article.
- Enter the coupon Quantity (up to 3000).
Note: If you enter a higher value, the request may time out. - Click Generate And Download.
A CSV file with the generated coupons is downloaded within a few minutes.
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>
- Create a sample coupon manually with the required settings (if a sample code was not provided by the brand).
- From the Discounts > Coupons page in Manage, open Developer Tools by pressing F12.
- Search for the sample code.
- Select the coupon?column line from the Network tab in developer tools.
- Copy the Response starting from
{"createdAt"
. - From the response that you copied, remove the following sections:
- createdAt
- id
- code
- issuer
- highlights
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}}
- Open Postman and copy the updated response into the Body tab.
- Enter your Symphony Manage credentials under the Authorization tab.
- 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.
- 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.
- Click Save > Save As and save this call as a new collection.
- Click on the Runner button in the top left corner of the app.
- Select the newly created collection
- 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. - Click Run.
A200 OK
message will be displayed after successful execution. - 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>; - 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.