Go to Marketing → Discounts & coupons and click Create coupon.
Enter a coupon code or click Generate.
Set the discount in % and choose whether it applies to all your products or only specific ones.
Optional: start and end date, maximum uses in total and per user.
Optional under Activation conditions: minimum order value, minimum number of items or required products in the cart.
Leave Active switched on and save.
Buyers redeem the code in the cart. The list shows usage and lets you deactivate, edit or delete coupons.

