Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hello fellow Umbracians (and Tea Commercians?)
Has anyone worked out a way to generate discount codes on the fly? Generating giftcards is very simple, but I have yet to find a way to generate discount codes.
I figured it out.
You have to first create a Marketing campaign through Tea Commerce, as far as I can see, you're not able to do this programatically using the Tea Commerce API.
When having created the Marketnig campaign, you have to add a Discount Code rule and an award, then you have to get the ID of the discount code rule. There's probably a way better way to get the ID, but the way I've done it so far is this:
// TODO: REMOVE THIS IN PRODUCTION
public ActionResult DiscountCodeGenerate(long storeId)
var allCampaigns = TeaCommerce.Api.Marketing.Services.CampaignService.Instance.GetAllActive(storeId);
var campaign = allCampaigns.FirstOrDefault(i => i.Name == "NewsletterSignupDiscount");
Next, you need to generate the actual code. So let's assume the rule ID is 1, you can execute the following code:
TeaCommerce.Api.Marketing.Services.DiscountCodeService.Instance.Generate(storeId, 1, 1, 1, 10, String.Empty, String.Empty);
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted