Hi,
You could use AcyMailing for that. It has an integration with HikaShop to automatically generate user specific coupons and send an email to the user with the coupon code after an order:
docs.acymailing.com/addons/joomla-add-ons/hikashop
That would save you a lot of time.
One alternative would be to use HikaSerial which has a coupon generator plugin:
www.hikashop.com/support/documentation/1...ugins-coupongen.html
So you would add a serial pack with that coupon plugin configured to each product, and HikaSerial would then add a serial for each product of each order with the corresponding coupons generated. And the serials (coupon codes) would be included in the email sent to the customer after the payment.
However, it's less flexible than what you can do with AcyMailing, so it might not fit your purpose.
A final solution is to develop your own plugin. You would implement the onAfterOrderCreate or onAfterOrderUpdate event:
www.hikashop.com/support/documentation/6...l#onAfterOrderCreate
In there, you would check that you want to generate the coupon for the order being processed, generate the coupon with the save method of class.discount, and then trigger the sending of an email with the Joomla email API:
docs.joomla.org/Sending_email_from_extensions